Skip to content

sql-dialect-fixes - #70

Merged
stbischof merged 10 commits into
eclipse-daanse:mainfrom
dbulahov:main201026
Oct 20, 2026
Merged

stbischof merged 10 commits into
eclipse-daanse:mainfrom
dbulahov:main201026

Conversation

@dbulahov

Copy link
Copy Markdown
Contributor

What does this PR do?

Commit Fix
dialect(mysql) A case-sensitive MATCHES stays case-sensitive: REGEXP follows the operand's collation (case-insensitive by default), so the pattern now starts with (?-i) (ICU, MySQL 8.0.4+; PCRE, MariaDB).
dialect(mssql) The mean of an integer column is not a whole number: SQL Server averaged 31 and 32 to 31. New default method AggregationGenerator.averageOperand; SQL Server reads the operand as float.
dialect(postgresql) Text aggregation is written with STRING_AGG; before, every text aggregation measure failed on PostgreSQL.
dialect(derby) Loading writes one statement at a time (supportsParallelLoading() = false); concurrent DDL deadlocked on Derby's system tables.
dialect(derby) The mean of an integer column is not a whole number (operand read as DOUBLE).
importer(csv) A table is looked up before a plain DROP TABLE when the dialect has no DROP TABLE IF EXISTS (Derby, Oracle before 23).
dialect(derby) A truth value is written as 1/0, the SMALLINT it is stored as.
dialect(derby) A quotient keeps its fraction. New default method FunctionGenerator.quotientDividend; the renderer asks the dialect for the dividend of a DIVIDE.
dialect(postgresql, mssql, h2) A quotient keeps its fraction: sum(units_shipped) / sum(units_ordered) came out as 0 instead of ~0.9.
dialect(postgresql, mysql) NAND/NOR/NXOR are the bitwise complement (~), not logical NOT.

…ttern

REGEXP follows the collation of its operand, case-insensitive by default, so "a.*" matched "A..." natively and not
when interpreted. The case-sensitive pattern starts with (?-i), read by ICU (MySQL 8.0.4+) and PCRE (MariaDB).

Signed-off-by: dbulahov <bulahovdenis@gmail.com>
SQL Server averages an INTEGER column to an INTEGER (31 for 31 and 32). The renderer asks the dialect for the operand of
an avg aggregate (AggregationGenerator.averageOperand, the operand itself by default); SQL Server reads it as float.

Signed-off-by: dbulahov <bulahovdenis@gmail.com>
PostgreSQL had no list aggregation, and every text aggregation measure failed: the SQL builder declined the segment and
the recorder could not write it either. STRING_AGG takes text only, so the operand is cast; DISTINCT beside an ORDER BY
over other columns is an error in PostgreSQL and is left out, as DuckDB does.

Signed-off-by: dbulahov <bulahovdenis@gmail.com>
Derby locks its system tables for DDL; tables and indexes created at once deadlocked while a test database was loaded.

Signed-off-by: dbulahov <bulahovdenis@gmail.com>
Derby averages an INTEGER column to an INTEGER, like SQL Server; the operand of avg is read as DOUBLE.

Signed-off-by: dbulahov <bulahovdenis@gmail.com>
A dialect without DROP TABLE IF EXISTS (Derby, Oracle before 23) writes a plain DROP TABLE, which fails on a table that
is not there; every fixture load on Derby failed so. The importer looks the table up by its exact name in its schema
first, the name escaped for the metadata pattern.

Signed-off-by: dbulahov <bulahovdenis@gmail.com>
The dialect stores a truth value as SMALLINT, and Derby does not compare SMALLINT with BOOLEAN; the literal is 1 or 0.

Signed-off-by: dbulahov <bulahovdenis@gmail.com>
Derby divides DECIMAL(31,4) by DECIMAL(31,4) at scale 0 and integers to an integer: a native ratio of 1.9 came out as 1.
The renderer asks the dialect for the dividend of a division (FunctionGenerator.quotientDividend, the dividend itself by
default); Derby reads it as DOUBLE.

Signed-off-by: dbulahov <bulahovdenis@gmail.com>
PostgreSQL, SQL Server and H2 divide integers to an integer, and a native filter over sum(units_shipped) /
sum(units_ordered) read 0 where MDX reads 0.9. The dividend is read as a floating type, as on Derby.

Signed-off-by: dbulahov <bulahovdenis@gmail.com>
…mplement

NOT is logical in both. PostgreSQL refused NOT(bit_and(x)) on an integer column; MySQL and MariaDB answered 0 or 1
where DuckDB and the provider answer -2 for the NAND of 1. The complement is ~; MySQL's BIT_AND is unsigned 64-bit, so
its complement is read as SIGNED.

Signed-off-by: dbulahov <bulahovdenis@gmail.com>
@stbischof
stbischof merged commit 4b48b16 into eclipse-daanse:main Oct 20, 2026
29 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants