mORMot2 DailyDaily read of upstream commits

DuckDB gains a native Quack client and closes its merge regressions

A pure Pascal Quack client now lets Delphi and FPC backends query a remote DuckDB server over HTTP without shipping the DuckDB library on the client. The code was consolidated into the existing DuckDB units, then hardened around value conversion, nanosecond timestamps and VARIANT columns. The final commit is important: it removes duplicate functions left by the branch merges and restores compilation of mormot.db.raw.duckdb.

TL;DR

  • TSqlDBQuackConnectionProperties, TSqlDBQuackConnection and TSqlDBQuackStatement provide a native HTTP client for Quack protocol versions 1 and 3 without a client-side DuckDB library.
  • The final public surface lives in mormot.db.raw.duckdb and mormot.db.sql.duckdb; the short-lived mormot.db.raw.quack and mormot.db.sql.quack units were removed during consolidation.
  • Quack array binding is rejected instead of executing one statement per row; ORM batches use MultipleValuesInsert, while direct callers should use multi-value SQL or a transaction.
  • QTYPE_TIMESTAMP_TZ_NS now preserves nanosecond scaling, and embedded DuckDB plus Quack reissue VARIANT result columns as JSON with duplicate names and NULL handled.
  • Do not stop on the intermediate merge: duplicated DuckDBTypeHasVariant and DuckDBVariantSql implementations made mormot.db.raw.duckdb fail to compile until 69900d77.

Upgrade advice

Land on merged revision 0186cd022309dcb6cd40b80f1b241f6bae4a0605, build 2.4.17677. Do not stop on merge 66d86995: it still contains duplicate DuckDBTypeHasVariant and DuckDBVariantSql implementations and does not compile. Quack users should also include d8ee7c1c for nanosecond timestamps and 16b6bc3b for VARIANT results. The raw payload records no later superseding fix.

Commits20
Lines+19713 -5192
Read4 min

14 of 14 entries · 20 commits upstream

Stories
# Entry Category Units
1 High VARIANT results are reissued as JSON for embedded and remote DuckDB DuckDBTypeHasVariant and TQuackType.HasVariant detect nested VARIANT columns. Both statement classes rerun the SELECT through DuckDBVariantSql so DuckDB casts those columns to JSON; the final merged helper uses positional references to support duplicate names and maps JSON null back to SQL NULL. Fixes mormot.db.raw.duckdb+3 16b6bc3b+281-25

duckdb/quack: return VARIANT columns as JSON

Impact

SELECT results containing VARIANT previously crashed the embedded driver or raised unsupported-type errors in Quack. They now arrive as JSON text, at the cost of re-executing the query once when a VARIANT column is detected.

Public API

  • DuckDBTypeHasVariant/DuckDBVariantSql/TQuackType.HasVariantadded — Adds public VARIANT detection and SELECT-wrapping helpers.
  • DuckDB and Quack VARIANT result columnsbehaviour-changed — VARIANT columns are exposed as JSON text, with VARIANT NULL returned as SQL NULL.

Claude · 14:38 UTC · view the commit on GitHub →

2 High Duplicate VARIANT helpers no longer break the DuckDB unit build The merge of the Quack branch and the separate VARIANT work left DuckDBTypeHasVariant and DuckDBVariantSql implemented twice in mormot.db.raw.duckdb. This commit deletes the second 41-line copy and keeps the final positional implementation. Fixes mormot.db.raw.duckdb 69900d77+0-41

db: remove duplicated DuckDBTypeHasVariant/DuckDBVariantSql in mormot.db.raw.duckdb

Impact

The intermediate merged tree did not compile because Pascal cannot accept duplicate routine implementations. The final tree builds again on Delphi and FPC without changing the intended VARIANT behavior.

tf · 13:46 UTC · view the commit on GitHub →

3 High Quack no longer inflates nanosecond timestamps by 1,000 The FIXED_TYPES table maps QTYPE_TIMESTAMP_TZ_NS to DUCKDB_TYPE_TIMESTAMP_TZ_NS instead of DUCKDB_TYPE_TIMESTAMP_TZ. test.db.quack compares TIMESTAMP_NS, TIMESTAMPTZ_NS and GEOMETRY values with the embedded engine. Fixes mormot.db.raw.duckdb+1 d8ee7c1c+8-1

db: Quack TIMESTAMPTZ_NS decoded with nanoseconds - DuckDB 2.0

Impact

Remote TIMESTAMPTZ_NS values were interpreted as microseconds and could be 1,000 times too large before conversion. Delphi and FPC Quack users reading this type receive the correct time after this commit.

Public API

  • QTYPE_TIMESTAMP_TZ_NS decodingbehaviour-changed — Values are scaled from nanoseconds through DUCKDB_TYPE_TIMESTAMP_TZ_NS rather than treated as microseconds.

tf · 07:57 UTC · view the commit on GitHub →

4 Medium Quack batch binding stops issuing one request per row TSqlDBQuackStatement.ExecutePrepared now raises on BindArray instead of looping over rows in an implicit transaction. ORM batches fall through MultipleValuesInsert, and timestamp scaling plus DUCKDB_POW10 move into mormot.db.raw.duckdb for shared use. Fixes mormot.db.raw.duckdb+2 0bfb4de6+41-106

db: Quack client without BindArray, shared POW10 and timestamp helpers

Impact

Direct Quack callers using BindArray receive an exception and must use a multi-values INSERT or their own transaction. ORM batch inserts keep working and avoid the previous per-row network round trips.

Worth a look

Search direct Quack statement code for BindArray; replace it with MultipleValuesInsert, multi-values SQL or an explicit transaction.

Public API

  • TSqlDBQuackStatement.ExecutePrepared BindArray handlingbehaviour-changed — BindArray now raises ESqlDBQuack instead of executing once per array row.
  • DuckTimestampMicros/DUCKDB_POW10added — Publishes shared timestamp scaling and decimal powers in mormot.db.raw.duckdb.

tf · 06:11 UTC · view the commit on GitHub →

5 Medium Remote DuckDB queries no longer require a client-side DuckDB library The commit adds a pure Pascal Quack wire decoder and TSqlDBQuackConnectionProperties, TSqlDBQuackConnection and TSqlDBQuackStatement for protocol versions 1 and 3. TSqlDBDuckDBConnectionProperties also gains QuackServe and QuackAttach helpers. New features mormot.db.raw.quack+2 c8a85ae4+4285-4

db: added a native DuckDB Quack protocol client

Impact

Delphi and FPC applications can use a remote DuckDB server over HTTP or HTTPS without loading the native DuckDB library locally. The final units differ from this first landing, so consumers should use the end-of-day revision.

Worth a look

Evaluate TSqlDBQuackConnectionProperties when a backend needs remote DuckDB access; use the final mormot.db.sql.duckdb unit, not the temporary mormot.db.sql.quack unit.

Public API

  • TSqlDBQuackConnectionProperties/TSqlDBQuackConnection/TSqlDBQuackStatementadded — Adds the public native Quack SQL client classes; their final declarations move to mormot.db.sql.duckdb later in the edition.
  • TSqlDBDuckDBConnectionProperties.QuackServe/QuackAttachadded — Adds helpers to start a Quack server and attach a remote Quack endpoint.

tf · 06:08 UTC · view the commit on GitHub →

6 Medium Quack APIs move into the established DuckDB units The wire protocol types move from mormot.db.raw.quack into mormot.db.raw.duckdb, and the TSqlDBQuackConnection classes move from mormot.db.sql.quack into mormot.db.sql.duckdb. The two standalone units and their Lazarus package entries are deleted. Under the hood mormot.db.raw.duckdb+3 d30776f3+2931-3041

db: Quack protocol and client merged into the DuckDB units

Impact

Existing applications from before this edition are unaffected. Code written against the short-lived initial Quack units must update its uses clause, but class and protocol identifiers keep their names.

Public API

  • mormot.db.raw.quack/mormot.db.sql.quackremoved — The standalone units are removed; their declarations now live in the corresponding DuckDB units.

tf · 06:16 UTC · view the commit on GitHub →

7 Low Quack connections report the DuckDB SQL dialect TSqlDBQuackConnectionProperties now passes dDuckDB rather than dPostgreSQL to its inherited constructor. The two constants currently share the same SQL rendering but the provider identity is now accurate. Fixes mormot.db.sql.duckdb 35d3606b+1-1

db: the Quack client uses the dDuckDB dialect constant too

Impact

Generated SQL does not change today because dDuckDB aliases dPostgreSQL. Delphi and FPC code sees the correct dialect identity for future dialect-specific behavior.

Public API

  • TSqlDBQuackConnectionProperties.Dialectbehaviour-changed — The connection properties now identify their dialect as dDuckDB rather than dPostgreSQL.

tf · 09:06 UTC · view the commit on GitHub →

8 Low Fixed-size DuckDB values share allocation-light conversion code DuckFixedSize, DuckFixedInt, DuckFixedToTextBuf, DuckFixedToText and DuckFixedToJson replace duplicated scalar conversion switches in embedded DuckDB and Quack. Quack numeric and UUID output avoids transient RawUtf8 allocations. Performance mormot.db.raw.duckdb+1 f85db8fd+386-333

db: DuckDB and Quack share the fixed-size value to text and JSON conversion

Impact

Result values keep their existing text and JSON formats. Quack scalar reads allocate less temporary memory; no Delphi or FPC application changes are required.

Public API

  • DuckFixedSize/DuckFixedInt/DuckFixedToTextBuf/DuckFixedToText/DuckFixedToJsonadded — Adds public helpers for fixed-size DuckDB scalar conversion from possibly unaligned addresses.

tf · 06:24 UTC · view the commit on GitHub →

9 Low Numeric and date columns converge on one conversion path DuckFixedToInt64, DuckFixedToDouble, DuckFixedToCurrency and DuckFixedToDateTime replace eight duplicated Column methods across embedded and Quack statements. TDuckDBTypeInfo caches the fixed value size. Under the hood mormot.db.raw.duckdb+1 23c49456+220-299

db: DuckDB and Quack share the ColumnInt/Double/Currency/DateTime conversion

Impact

ColumnInt, ColumnDouble, ColumnCurrency and ColumnDateTime keep their contracts for Delphi and FPC backends. The refactor reduces divergent behavior between local and remote DuckDB results.

Public API

  • TDuckDBTypeInfo.Sizeadded — Adds the cached byte size of a fixed-size logical value, or zero for variable-size types.
  • DuckFixedToInt64/DuckFixedToDouble/DuckFixedToCurrency/DuckFixedToDateTimeadded — Publishes shared typed conversion helpers for fixed-size DuckDB values.

tf · 06:26 UTC · view the commit on GitHub →

10 Low Quack vector ownership moves to managed byte strings TQuackVector owns temporary buffers as RawByteString instead of GetMem blocks, object arrays are cleared with ObjArrayClear, and type storage selection moves into TQuackType.SetStorage. Integer reads use fixed-width pointer types. Under the hood mormot.db.raw.duckdb f9fc6733+106-123

db: Quack review hints - RawByteString buffers, ObjArrayClear, TQuackType.SetStorage

Impact

Quack result decoding keeps the same values while relying on managed lifetime cleanup on Delphi and FPC. No application-code change is required.

Public API

  • TQuackType.SetStorageadded — Publishes the method that derives Storage, ElemSize and DuckType from the decoded Quack type.

tf · 09:27 UTC · view the commit on GitHub →

11 Low Embedded and remote TIME_TZ values use one formatter TQuackType.FieldType now delegates to DuckDBTypeToField, and DuckTimeTzToText centralizes TIME_TZ formatting for both DuckDB vectors and Quack vectors in mormot.db.raw.duckdb. Under the hood mormot.db.raw.duckdb+1 530dc720+29-58

db: Quack types and TIME_TZ text share the DuckDB helpers

Impact

Delphi and FPC backends keep the same TIME_TZ text and field types. The change removes duplicate conversion paths, so there is no application-code migration.

Public API

  • DuckTimeTzToTextadded — Adds a public TIME_TZ-to-text helper in mormot.db.raw.duckdb.

tf · 06:18 UTC · view the commit on GitHub →

12 Low The ORM test suite exercises an external DuckDB database test.orm.extdb adds an in-memory DuckDB scenario with a 2,000-row batch, retrieval, query, update, delete and BLOB batch. It deliberately uses direct REST calls and skips the slow generic external-database and virtual-table cases. Tests test.orm.extdb 1cadd7fb+127-0

test: external DuckDB database through the ORM

Impact

There is no production API or runtime change. The test increases coverage of ORM batch and CRUD behavior for DuckDB under both Delphi and FPC builds.

tf · 09:06 UTC · view the commit on GitHub →

13 Low A console client demonstrates all three DuckDB access paths ex/ThirdPartyDemos/tobfel/duckdb-cli adds a sqlite3-style console program for embedded DuckDB, mormot.db.proxy and remote Quack, plus Python and Pascal benchmark helpers and usage documentation. Docs bc5b1490+749-0

ex: duckdbcli, a SQL command line client for DuckDB (embedded, proxy, Quack)

Impact

Framework behavior and public APIs do not change. Delphi and FPC developers gain a runnable example for comparing local, proxy and Quack connections.

tf · 06:39 UTC · view the commit on GitHub →

14 Low DuckDB review rules are recorded for future contributors CLAUDE.md and src/db/CLAUDE.md document review guidance on API ownership, allocation, endian-safe reads, Pascal portability and SQL-driver testing. No Pascal source is changed. Docs 93ce8f7a+102-0

docs: CLAUDE.md with code-quality rules from the DuckDB review

Impact

There is no runtime, build or application-code impact for Delphi or FPC backends; this is contributor documentation only.

tf · 16:41 UTC · view the commit on GitHub →

Upstream activity commits per day · last 60 days
Commits1007
Active days49/60
Busiest2026-09-30
Peak60
2026-09-30: 60 commits2026-10-01: 26 commits2026-10-02: 30 commits2026-10-03: 32 commits2026-10-04: 15 commits2026-10-05: 1 commit2026-10-06: 26 commits2026-10-07: 37 commits2026-10-08: 27 commits2026-10-09: 35 commits2026-10-10: 12 commits2026-10-11: 2 commits2026-10-12: 40 commits2026-10-13: 31 commits2026-10-14: 23 commits2026-10-15: 16 commits2026-10-16: 27 commits2026-10-17: 0 commits2026-10-18: 0 commits2026-10-19: 0 commits2026-10-20: 0 commits2026-10-21: 0 commits2026-10-22: 3 commits2026-10-23: 6 commits2026-10-24: 29 commits2026-10-25: 7 commits2026-10-26: 25 commits2026-10-27: 4 commits2026-10-28: 8 commits2026-10-29: 17 commits2026-10-30: 20 commits2026-10-31: 0 commits2026-11-01: 0 commits2026-11-02: 16 commits2026-11-03: 32 commits2026-11-04: 15 commits2026-11-05: 32 commits2026-11-06: 26 commits2026-11-07: 19 commits2026-11-08: 2 commits2026-11-09: 29 commits2026-11-10: 17 commits2026-11-11: 8 commits2026-11-12: 38 commits2026-11-13: 39 commits2026-11-14: 9 commits2026-11-15: 6 commits2026-11-16: 21 commits2026-11-17: 30 commits2026-11-18: 37 commits2026-11-19: 28 commits2026-11-20: 31 commits2026-11-21: 0 commits2026-11-22: 0 commits2026-11-23: 1 commit2026-11-24: 6 commits2026-11-25: 3 commits2026-11-26: 3 commits2026-11-27: 0 commits2026-11-28: 0 commits
2026-09-302026-11-28