Repository navigation
dialect(mssqlserver): fixes, tested on SQL Server in Docker - #101
Merged
Merged
Conversation
stbischof
approved these changes
Nov 24, 2026
DuckDB is embedded and serves no connection: the tests run the CLI of each version in Docker (duckdb/duckdb 1.0.0 to 2.0.1) on the SQL the dialect writes, the dialect built for the version the CLI reports. DuckDbDialect: - generateListAgg: DISTINCT kept with an order by the value itself, was left out with any ORDER BY; a quote in the separator doubled, broke the statement; " ORDER BY" spaced, was "nameORDER BY" without one - generatePercentileDisc/Cont: PERCENTILE_DISC/CONT(p) WITHIN GROUP (ORDER BY col [DESC]); quantile_disc/cont(col, p) took no order, so a descending percentile came out ascending - supportsNthValueIgnoreNulls: true, the list is filtered with FILTER (WHERE v IS NOT NULL); was false pom: testcontainers junit-jupiter (test), DOCKER_HOST for surefire Container tests: - DuckDbCli: runs the CLI of a tag, files put into the container, the version checked against the tag; an error counts by stderr too, the CLI of 1.2.0 to 1.2.2 exits with 0 on one - DuckDbGroupingSetsTest: GROUPING SETS, ROLLUP, CUBE, GROUPING() - DuckDbListAggTest: STRING_AGG ordered, DISTINCT, separators, NULLS FIRST/LAST, per group; DISTINCT by another column refused by DuckDB - DuckDbPercentileTest: PERCENTILE_DISC/CONT ascending, descending, at the ends, per group - DuckDbNthValueContainerTest: n-th value counting or leaving out NULLs, past the end, n below 1, order, per group - DuckDbBitAggregationTest: AND, OR, XOR, NAND, NOR, NXOR on INTEGER and BIGINT past 32 bits, per group, NULLs alone - DuckDbRenameTest: table and column renamed, refused with an index (Dependency Error); no index or constraint rename - DuckDbAddConstraintTest: unique, check and foreign key in CREATE TABLE, enforced; ALTER TABLE ADD refused, ADD UNIQUE from 2.0 only while no table refers to it - DuckDbBulkLoadTest: read_csv of the importer's files, values kept as written, delimiters, quotes, NULL literals, skip lines, defaults, a large file; a # line left out from 1.1, refused by 1.0 Signed-off-by: <bulahovdenis@gmail.com>
Checked on SQL Server 2017, 2019, 2022 and 2025 in Docker, the dialect built from a live connection. MicrosoftSqlServerDialect: - supportsPercentileDisc/Cont: false, generatePercentileDisc/Cont empty; SQL Server has PERCENTILE_DISC/CONT only as window functions, "must have an OVER clause" (Msg 10753), so the aggregate always failed - generateListAgg: NULLS FIRST/LAST ranked with a CASE, SQL Server has no NULLS (syntax error); a quote in the separator doubled, broke the statement; the operand as NVARCHAR(MAX) and the separator N'...', the list stopped at 8000 bytes (Msg 9829) - mergeGenerator: MERGE INTO t WITH (HOLDLOCK); two connections upserting the same new key at once both inserted, one failing on the primary key - createSequence: with ifNotExists guarded by sys.sequences, SQL Server has no CREATE SEQUENCE IF NOT EXISTS (syntax error) - dropTable: with ifExists OBJECT_ID(N'"s"."t"', N'U') of the quoted name; a name of a quote broke the statement - createTrigger: a WHEN condition refused (UnsupportedOperationException); SQL Server has no WHEN, and left out the trigger fired for every row MicrosoftSqlServerGeneratorsTest: MERGE with HOLDLOCK Container tests: - MsSqlPercentileTest: no percentile aggregate, the server refuses one; the window form over a partition works - MsSqlListAggTest: STRING_AGG ordered, NULLS FIRST/LAST, separators, INT and Unicode, longer than 8000 bytes, per group; no DISTINCT - MsSqlMergeGeneratorTest: upsert with and without update columns, composite key, a quote and Unicode, 8 connections upserting at once - MsSqlCreateFunctionTest, MsSqlCreateProcedureTest: created, called, OR ALTER replaces the body and keeps the object and its grants; OUT and INOUT parameters, no parameters, an inline table function - MsSqlDropFunctionIfExistsTest, MsSqlDropProcedureIfExistsTest: IF EXISTS, named without types; a schema-bound view and a routine of the other kind of the name not passed over - MsSqlSequenceTest: options, CYCLE, NO CYCLE, a column default, IF NOT EXISTS, rename (refused with a dependent default), drop; no options start at the least BIGINT - MsSqlDropIfExistsTest: DROP TABLE of names of a quote, a dot, a blank; DROP VIEW, INDEX ... ON, SCHEMA IF EXISTS; a schema that holds a table - MsSqlTriggerProcedureTest: trigger procedure created and replaced, called after insert, update, delete; WHEN refused, written into the body instead - MsSqlDropTriggerProcedureTest: dropped of a schema, of none, of a quote in the name; one a trigger calls dropped, the trigger then fails Signed-off-by: <bulahovdenis@gmail.com>
stbischof
force-pushed
the
main241126_2
branch
from
November 24, 2026 18:15
a9d06bb to
ccd20e8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
dialect(mssqlserver): fixes, tested on SQL Server in Docker
Checked on SQL Server 2017, 2019, 2022 and 2025 in Docker, the dialect
built from a live connection.
MicrosoftSqlServerDialect:
SQL Server has PERCENTILE_DISC/CONT only as window functions, "must
have an OVER clause" (Msg 10753), so the aggregate always failed
no NULLS (syntax error); a quote in the separator doubled, broke the
statement; the operand as NVARCHAR(MAX) and the separator N'...', the
list stopped at 8000 bytes (Msg 9829)
the same new key at once both inserted, one failing on the primary key
has no CREATE SEQUENCE IF NOT EXISTS (syntax error)
name; a name of a quote broke the statement
SQL Server has no WHEN, and left out the trigger fired for every row
MicrosoftSqlServerGeneratorsTest: MERGE with HOLDLOCK
Container tests:
the window form over a partition works
INT and Unicode, longer than 8000 bytes, per group; no DISTINCT
composite key, a quote and Unicode, 8 connections upserting at once
OR ALTER replaces the body and keeps the object and its grants; OUT
and INOUT parameters, no parameters, an inline table function
EXISTS, named without types; a schema-bound view and a routine of the
other kind of the name not passed over
EXISTS, rename (refused with a dependent default), drop; no options
start at the least BIGINT
DROP VIEW, INDEX ... ON, SCHEMA IF EXISTS; a schema that holds a table
called after insert, update, delete; WHEN refused, written into the
body instead
quote in the name; one a trigger calls dropped, the trigger then fails