Skip to content

Add a DuckDB engine (PostgreSQL query set, local reference) - #11

Merged
litkhai merged 2 commits into
masterfrom
duckdb-engine
Oct 9, 2026
Merged

litkhai merged 2 commits into
masterfrom
duckdb-engine

Conversation

@litkhai

@litkhai litkhai commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Closes #10

What

DuckDB as a sixth engine, wired like the others. Its query set is the PostgreSQL query set of this
repository, so it can serve as a local reference for engines that parse PostgreSQL SQL.

  • tools/sync-upstream.sh duckdb — PostgreSQL text + a DuckDB-only fix only for the two queries that fail on DuckDB.
    The script aborts if a fix stops changing its query or if an unfixed query drifts from the PostgreSQL text.
  • tools/derive-ddl.sh duckdb — same types as PostgreSQL; DuckDB accepted every one.
  • engines/duckdb/load/load.sh — COPY per .dat file; row count checked against the file line count; CHECKPOINT.
  • bin/ — duckdb in ENGINES, engine_exec (-bail, -nullvalue '', optional DUCKDB_THREADS / DUCKDB_MEMORY_LIMIT), check_client, ddl.sh / load.sh / run.sh help.
    bin/run.sh no longer uses mapfile, so it runs on macOS bash 3.2 (the duckdb client runs on the host).
  • tools/verify.sh --engine duckdb — host CLI + temporary database file, no docker; added to --all.
  • CI — duckdb in the query-count loop and in the engine matrix; CLI pinned to v1.5.6, duckdb_cli-linux-amd64.zip checked against the release asset digest. No new job.
  • Docs — docs/engines/duckdb.md, engine index, nav, README, NOTICE, quickstart, commands, licensing, verification page.

Compatibility of the PostgreSQL files on DuckDB (measured 2026-10-09, DuckDB v1.5.6, macOS arm64, fixture from tools/make-fixture.py)

101 of 103 engines/postgres/queries/*.sql run unchanged. The two that do not fail at parse time:

Query First error DuckDB-only fix
q77 Parser Error: syntax error at or near "returns" coalesce(returns, 0) returns -> coalesce(returns, 0) as returns
q90 Parser Error: syntax error at or near "at" ) at, -> ) as "at",

Full per-query table: docs/engines/duckdb.md. "Runs" = parse, bind and execute with exit status 0; 47 of the 103 return zero rows on this fixture, and no answer was compared.

Verification

tools/verify.sh --all on 2026-10-09: postgres 103/103, clickhouse 102/103 (+1 known), starrocks 103/103, duckdb 103/103 (also in results/verification.md).
Fault injection: a broken from date_dim_missing in engines/duckdb/queries/query42.sql made verify.sh --engine duckdb report 102/103 (1 unexpected) and q42; a stale q77 pattern in the generator aborts with "pattern is stale"; a missing duckdb binary fails with a clear message.

Not run

  • The CI workflow (this PR's first run is the first run; the pinned Linux asset's sha256 and zip layout were checked by hand, the step itself was not executed).
  • Any scale factor above the fixture (trailing-delimiter behaviour, load time, memory, primary-key cost on real dsdgen output).
  • tools/verify-docs.sh (browser check; tools/verify-docs.js hardcodes its engine list and was not touched, so DuckDB is not covered by it).

Delegated-work cost (cost.py): not measured.

🤖 Generated with Claude Code

litkhai and others added 2 commits October 9, 2026 11:24
…rify (#10)

DuckDB runs the PostgreSQL-dialect queries of this repository, so it serves as a
local reference for engines that parse PostgreSQL SQL.

- tools/sync-upstream.sh duckdb: the PostgreSQL text plus a DuckDB-only fix only for
  the two queries that fail to parse on DuckDB 1.5.6 (q77 "returns" alias needs AS,
  q90 "at" alias quoted); the script fails if a fix goes stale or an unfixed query
  drifts from the PostgreSQL text. 101 of 103 files are identical to engines/postgres.
- tools/derive-ddl.sh duckdb: same types as PostgreSQL; DuckDB accepted all of them.
- engines/duckdb/load/load.sh: COPY per .dat file (DuckDB accepts dsdgen's trailing
  delimiter), row count checked against the file line count, CHECKPOINT at the end.
- bin/: duckdb in ENGINES, engine_exec (-bail, DUCKDB_THREADS/MEMORY_LIMIT), no-op
  engine_exec_nodb, check_client; run.sh reads query files without mapfile so it
  runs on macOS bash 3.2 where the duckdb client lives.
- tools/verify.sh --engine duckdb: host CLI and a temporary database, no docker;
  added to --all.
- CI: duckdb in the query-count loop and the engine matrix, CLI pinned to v1.5.6 and
  checked against the release asset digest.
- Docs: docs/engines/duckdb.md with the dated PostgreSQL-on-DuckDB compatibility table.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…s, clickhouse, starrocks, duckdb) (#10)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@litkhai
litkhai merged commit b107f50 into master Oct 9, 2026
3 checks passed
@litkhai
litkhai deleted the duckdb-engine branch October 9, 2026 15:58
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.

Add a DuckDB engine

1 participant