mORMot2 DailyDaily read of upstream commits

DuckDB batch inserts move to the Appender path

DuckDB now routes ORM batch creates through TSqlDBDuckDBAppender instead of statement arrays, while retaining a multi-value INSERT fallback for partial columns and conflict options. Result decoding also caches logical and nested types once per column. DuckDB users with direct BindArray calls or low-level vector conversion code need to adjust before upgrading.

TL;DR

  • DuckDB ExecutePrepared now rejects BindArray parameter sets; use ORM batching, OnBatchInsert or explicit transactional inserts.
  • ORM create batches use the DuckDB Appender when every table column is supplied in order, with a 4,096-row batch limit and a safe INSERT fallback.
  • Logical and nested DuckDB types are cached once per result column, avoiding repeated C API type discovery and transient strings while reading rows.
  • The final Appender accepts ORM-generated schema-qualified names such as main.TableName.

Upgrade advice

Land on merge 723a3172734c6c8546fb7f4757383d868b06e019 at build 2.4.17677, which includes the schema-qualified Appender fix. Before upgrading a DuckDB backend, grep for BindArray, BindArrayCurrency, BindArrayDateTime and direct calls to DuckDBVectorValueToJson, DuckDBVectorValueToText or DuckDBVectorValueToTextBuf. The raw payload lists no superseded_by successor.

Commits6
Lines+936 -692
Read2 min

5 of 5 entries · 6 commits upstream

Stories
# Entry Category Units
1 Medium DuckDB result types are parsed once per column mormot.db.raw.duckdb adds TDuckDBTypeInfo and recursive DuckDBTypeInfoInit and DuckDBTypeInfoDone helpers. TSqlDBDuckDBStatement builds one cache per result column and reuses it for DECIMAL, ENUM, LIST, ARRAY, MAP, STRUCT and UNION conversion. Numeric values, UUID values and MAP keys use stack buffers where possible. The public DuckDBVectorValueToJson, DuckDBVectorValueToText and DuckDBVectorValueToTextBuf parameters change from TDuckDBLogicalType to PDuckDBTypeInfo. Breaking changes mormot.db.raw.duckdb+1 0c5d1ac1+293-191

db: DuckDB logical types are now parsed once into a TDuckDBTypeInfo cache

Impact

Queries returning many rows, especially nested DuckDB values, avoid repeated logical-type API calls, child-handle creation and transient RawUtf8 allocation. Application code using only ISqlDBRows is unaffected, but direct callers of the three vector helpers no longer compile until they provide a TDuckDBTypeInfo cache with the new lifetime rules.

Migration required

If you call DuckDBVectorValueToJson, DuckDBVectorValueToText or DuckDBVectorValueToTextBuf directly, initialize TDuckDBTypeInfo with DuckDBTypeInfoInit, pass its address, and release it with DuckDBTypeInfoDone after the vectors are finished.

Public API

  • TDuckDBTypeInfoadded — Caches a logical type, its nested children, scale, internal storage and names.
  • DuckDBTypeInfoInitadded — Recursively parses a TDuckDBLogicalType and transfers ownership of its handle to TDuckDBTypeInfo.
  • DuckDBTypeInfoDoneadded — Releases cached child storage and all owned logical-type handles.
  • DuckDBEnumValueadded — Returns an ENUM label and lazily caches the complete dictionary.
  • DuckDBTypeToFieldadded — Exposes DuckDB-to-TSqlDBFieldType mapping from mormot.db.raw.duckdb.
  • DuckDBVectorValueToJsonsignature-changed — Its type argument is now PDuckDBTypeInfo instead of TDuckDBLogicalType.
  • DuckDBVectorValueToTextsignature-changed — Its type argument is now PDuckDBTypeInfo instead of TDuckDBLogicalType.
  • DuckDBVectorValueToTextBufsignature-changed — Its type argument is now PDuckDBTypeInfo instead of TDuckDBLogicalType.

tf · 05:55 UTC · view the commit on GitHub →

2 Medium DuckDB drops statement arrays in favor of Appender-backed ORM batches TSqlDBDuckDBConnectionProperties now advertises BatchSendingAbilities=[cCreate], installs AppendBatchInsert as OnBatchInsert and caps each batch at 4,096 rows. Complete, ordered create batches go through TSqlDBDuckDBAppender; partial column sets and boInsertOrIgnore, boInsertOrReplace or boUpsert fall back to MultipleValuesInsert. TSqlDBDuckDBStatement.ExecutePrepared now raises when fParamsArrayCount is non-zero instead of executing BindArray rows one by one. Breaking changes mormot.db.sql.duckdb 120ac439+141-136

db: DuckDB BindArray removed, OnBatchInsert now uses the Appender

Impact

ORM create batches can use DuckDB's native bulk path and no longer depend on the slower per-row statement-array loop. Existing Delphi or FPC code that directly binds arrays to a DuckDB statement will still compile but will fail at ExecutePrepared after this upgrade.

Migration required

Find DuckDB statements using BindArray, BindArrayCurrency or BindArrayDateTime. Replace them with ORM batching or OnBatchInsert where possible; otherwise execute ordinary parameter sets inside an explicit transaction.

Public API

  • ISqlDBStatement.BindArraybehaviour-changed — For DuckDB statements, ExecutePrepared now rejects any array-bound parameter set.
  • TSqlDBDuckDBConnectionProperties.OnBatchInsertbehaviour-changed — Create batches now use TSqlDBDuckDBAppender when the complete table column list is supplied in order.

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

3 Medium DuckDB Appender resolves schema-qualified ORM table names TSqlDBDuckDBAppender.Create splits a schema-qualified aTable when aSchema is empty, passing the schema and bare table name separately to duckdb_appender_create. The batch test now calls OnBatchInsert with main.arr, matching the table names supplied by ORM external storage. Fixes mormot.db.sql.duckdb 1d9eae84+17-4

db: DuckDB Appender accepts a schema-qualified table name

Impact

The new Appender-backed ORM batch path works with the default main.TableName form instead of looking for a literal table containing a dot. This fixes the failure found by the DuckDB ORM external tests before the feature reached the final merge.

Public API

  • TSqlDBDuckDBAppender.Createbehaviour-changed — When aSchema is empty, schema.table in aTable is now split for duckdb_appender_create.

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

4 Low Numeric column readers share one DuckDB integer set mormot.db.sql.duckdb introduces the internal DUCKDB_INT_TYPES set and uses it in both TSqlDBDuckDBStatement.ColumnDouble and ColumnCurrency. The duplicated case branches for BOOLEAN and signed or unsigned integer types are replaced by the same ReadIntegral path. Under the hood mormot.db.sql.duckdb 78780e65+13-10

db: DuckDB integer type list shared by ColumnDouble and ColumnCurrency

Impact

There is no intended change for Delphi or FPC application code or returned numeric values. The refactor keeps the two conversion methods aligned as DuckDB integer support evolves.

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

5 Low DuckDB gets a named SQL dialect alias mormot.db.raw.duckdb exports dDuckDB as an alias of dPostgreSQL, and TSqlDBDuckDBConnectionProperties now assigns that symbol to fDbms. TSqlDBDuckDBAppender.Create replaces its manual dot search and copies with SplitRight when separating schema.table. Under the hood mormot.db.raw.duckdb+1 288e3cbf+10-11

db: DuckDB uses SplitRight() and a dDuckDB = dPostgreSQL constant

Impact

Existing Delphi and FPC backends retain PostgreSQL-like DuckDB SQL generation and the same schema parsing behavior. The alias provides a stable DuckDB-specific symbol if its dialect diverges later; no application change is required.

Public API

  • dDuckDBadded — Public TSqlDBDefinition alias currently equal to dPostgreSQL for DuckDB SQL generation.

tf · 09:05 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