mORMot2 DailyDaily read of upstream commits

DuckDB refactor settles after a dense chain of correctness fixes

DuckDB and Quack dominate this edition: a large raw and SQL refactor was followed by fixes for variant bitmaps, signed dates, text fallback, Delphi compilation and error-message lifetime. Teams using either DuckDB backend should take the complete sequence rather than an intermediate build. The day also adds small core helpers, exposes PKCS#8 wrapping and refines Windows Authenticode status reporting.

TL;DR

  • Land on build 2.4.17809; builds 2.4.17801 through 2.4.17808 contain successive DuckDB and Quack regressions or incomplete fixes.
  • The final DuckDB fixes preserve signed pre-1970 dates, safe short-text conversion and error text before destroying a result.
  • Direct users of mormot.db.raw.duckdb helpers must review removed or changed public signatures introduced by the large refactor.
  • Windows Authenticode now distinguishes an unavailable wintrust.dll, but TWinVerifyStatus ordinal values changed.
  • PrivateKeyToPkcs8 is now public and restores the helper removed in the immediately preceding build.

Upgrade advice

DuckDB or Quack users should land on c3f4abb0d5eefab919131bdcb6cb18a97729d2d7, build 2.4.17809, and retest VARIANT columns, dates before 1970, numeric/date reads from VARCHAR and failing queries. Do not stop on 2.4.17801-2.4.17808. If you consume raw DuckDB helpers, compile for the public signature changes. The raw payload records no later superseded_by revision.

Build2.4.17677 → 2.4.17809
Commits16
Lines+1553 -1285
Read6 min

16 of 16 entries · 16 commits upstream

Stories
# Entry Category Units
1 High Raw DuckDB conversion APIs are reshaped around fixed-value helpers mormot.db.raw.duckdb adds DuckFixedSize, DuckFixedInt, DuckFixedToTextBuf, DuckFixedToText, DuckFixedToJson, DuckFixedToInt64, DuckFixedToDouble, DuckFixedToCurrency and DuckFixedToDateTime. It changes DuckDBEnumValue to a procedure with a var result, changes DuckDBVariantSql flags from TBooleanDynArray to TBytes, changes DuckHugeIntIsInt64 from const to var, adds TQuackType and TQuackVector helpers, and removes public QuackInt16, QuackInt32 and QuackInt64. Breaking changes mormot.db.raw.duckdb e6ce529b+958-838

db: huge mormot.db.raw.duckdb refactoring

Impact

The higher-level DuckDB and Quack statement APIs are adapted in-tree, but application code calling the raw helpers directly can fail to compile. The first implementation also begins the regression chain fixed through build 2.4.17809.

Migration required

Grep direct uses of DuckDBEnumValue, DuckDBVariantSql, DuckHugeIntIsInt64, QuackInt16, QuackInt32 and QuackInt64; update signatures or replace removed unaligned readers, then compile against build 2.4.17809.

Public API

  • DuckFixedSize/DuckFixedInt/DuckFixedTo*added — Public fixed-value conversion helpers are added for text, JSON, integer, floating, currency and TDateTime results.
  • DuckDBEnumValuesignature-changed — The RawUtf8-returning function becomes a procedure with a var RawUtf8 result.
  • DuckDBVariantSqlsignature-changed — The IsVariant argument changes from TBooleanDynArray to a bit-packed TBytes array.
  • QuackInt16/QuackInt32/QuackInt64removed — The three public unaligned integer readers are removed.

Arnaud Bouchez · 16:18 UTC · view the commit on GitHub →

2 High DuckDB errors no longer outlive the result text they reference TDuckDBLib.RaiseResultError in mormot.db.raw.duckdb now creates the ESqlDBDuckDB exception while result_error(res) is still valid, then calls destroy_result and raises the stored exception. The previous code kept a PUtf8Char, destroyed its owner and formatted the exception afterward. Fixes mormot.db.raw.duckdb c3f4abb0+6-6

db: fixed TDuckDBLib.RaiseResultError methjod

Impact

Failed DuckDB queries now report stable error text instead of reading freed memory, which could produce corrupted diagnostics or an access violation. Delphi and FPC callers keep the same API.

Arnaud Bouchez · 18:49 UTC · view the commit on GitHub →

3 High Quack short-text fallback now returns the buffer it filled TQuackVector.TextAt now assigns result := @Temp after copying a short string and adding its NUL terminator. TQuackVector.StringAt also uses @StrBytes[StrOffs^[Index]] for explicit byte-array pointer arithmetic. Fixes mormot.db.raw.duckdb 1ac40d31+4-3

db: fixed TQuackVector.TextAt regression

Impact

Quack ColumnInt, ColumnDouble, ColumnCurrency and ColumnDateTime fallbacks no longer receive an undefined pointer after a short string was copied. This repairs the regression introduced in build 2.4.17806 without changing callers.

Public API

  • TQuackVector.StringAtbehaviour-changed — The returned pointer is now formed from the indexed byte-array address.

Arnaud Bouchez · 18:26 UTC · view the commit on GitHub →

4 Medium Signed DuckDB integers are corrected while variant storage remains unsafe DuckFixedInt and decimal integer decoding switch INTEGER and DATE reads from PCardinal to PInteger. SQL column conversions compute the current row pointer before using the fixed-value helpers. The same commit changes VARIANT byte-array sizing to (count + 31) shr 5, which is too short for SetBitPtr's 32-bit writes and is corrected in build 2.4.17806. Fixes mormot.db.raw.duckdb+1 af2c1635+36-36

db: several DuckDB fixes

Impact

Negative INTEGER and DATE values decode correctly, and row-specific conversions use the right address. This revision must not be deployed alone because VARIANT flags can write outside their allocated array.

Arnaud Bouchez · 17:58 UTC · view the commit on GitHub →

5 Medium DuckDB fixes variant storage and signed tiny integers but briefly breaks TextAt The VARIANT bitmaps in both DuckDB paths are sized as (count + 31) shr 3 so SetBitPtr has complete 32-bit words. JSON serialization stops swapping TINYINT and UTINYINT. TQuackVector.TextAt gains a TTemp47 parameter and copies short strings to a NUL-terminated buffer, but this revision forgets to return @Temp. Fixes mormot.db.raw.duckdb+1 f0d2201d+32-17

db: another pass of DuckDB fixes

Impact

VARIANT-column flags no longer write past an undersized byte array, and signed 8-bit values keep their sign in JSON. This build is not a safe stopping point because its TextAt fallback is repaired by the next commit.

Public API

  • TQuackVector.TextAtsignature-changed — TextAt now requires a caller-supplied TTemp47 buffer.

Arnaud Bouchez · 18:21 UTC · view the commit on GitHub →

6 Medium DuckDB dates before 1970 keep their sign during conversion DuckFixedToText and DuckFixedToDateTime now read DUCKDB_TYPE_DATE through PInteger instead of PCardinal. The unit also reuses shared microsecond constants, while mormot.core.os adds MicroSecsPerHour; its Delphi-safe QWord typing arrives later in build 2.4.17808. Fixes mormot.core.os+1 00caeaf5+10-11

db: fixed DuckDB date/time conversions

Impact

Negative day counts now represent pre-1970 dates instead of becoming large unsigned dates. Application APIs are unchanged, but Delphi users should not stop on this build because the new constant still causes a compiler issue fixed later.

Worth a look

After moving to 2.4.17809, retest DATE values on both sides of 1970 and around the TDateTime epoch.

Public API

  • MicroSecsPerHouradded — A shared hourly microsecond constant is added to mormot.core.os.

Arnaud Bouchez · 18:04 UTC · view the commit on GitHub →

7 Medium Authenticode reports unsupported Windows trust separately mormot.core.os.security adds wvsUnsupported to TWinVerifyStatus when wintrust.dll cannot be resolved and publishes ToText(TWinVerifyStatus). Tests log the symbolic status and strengthen tampered-file checks. The same commit removes the local PrivateKeyToPkcs8 implementation while TCryptPrivateKey.Save still calls it; the next build restores it publicly. New features mormot.core.os.security+3 d41fa5d8+33-53

crypt: another pass on WinVerifyExeSignature() #699

Impact

Windows callers can distinguish an unavailable trust API from a bad file, and can format statuses by enum name. Build 2.4.17795 is not a valid stopping point because the missing PrivateKeyToPkcs8 helper breaks the secure unit until 2.4.17796.

Public API

  • TWinVerifyStatus.wvsUnsupportedadded — Represents an operating system where wintrust.dll is unavailable.
  • ToText(TWinVerifyStatus)added — Returns the RTTI enum name as PShortString.

Arnaud Bouchez · 09:03 UTC · PR #699 · view the commit on GitHub →

8 Medium RSA private keys gain a public PKCS#8 wrapping helper mormot.crypt.secure publishes PrivateKeyToPkcs8. It detects a PKCS#1 RSA DER sequence and wraps it as PKCS#8 PrivateKeyInfo with the algorithm identifier and private-key OCTET STRING; ECC and EdDSA DER already in PKCS#8 form is returned unchanged. New features mormot.crypt.secure b0c25293+42-10

crypt: follow-up of #697 PKCS#8 support

Impact

Applications can explicitly normalize private-key DER before calling Pkcs8EncryptPrivateKey. The addition also restores the helper removed in build 2.4.17795, so that intermediate build should not be used.

Public API

  • PrivateKeyToPkcs8added — Converts PKCS#1 RSA DER to PKCS#8 PrivateKeyInfo and passes existing PKCS#8 DER through.

Arnaud Bouchez · 09:04 UTC · PR #697 · view the commit on GitHub →

9 Medium DuckDB SQL results use cached vectors and compact variant flags mormot.db.sql.duckdb reorganizes TSqlDBDuckDBStatement around cached column vectors, row pointers and a TBytes VARIANT bitmap. It routes fixed values through the new raw helpers, writes scalar JSON directly, preserves error text before result destruction and documents local DuckDB and Quack connection modes. Performance mormot.db.sql+1 eb1f9937+215-166

db: optimized and refactored mormot.db.sql.duckdb

Impact

The normal SQL statement API is unchanged and common scalar reads avoid repeated conversion work. This is an intermediate refactor build: its compact bitmap allocation is too short for SetBitPtr and later commits repair several conversion paths.

Arnaud Bouchez · 16:19 UTC · view the commit on GitHub →

10 Medium Delphi builds and VARCHAR fallback recover after the DuckDB rewrite mormot.core.os types MicroSecsPerHour as QWord to avoid Delphi constant overflow. mormot.db.raw.duckdb appends an INTERVAL separator to its local buffer, and mormot.db.sql.duckdb makes ColumnTemp read the current VARCHAR row into a NUL-terminated TTemp47 before numeric or date parsing. Compiler & platform mormot.core.os+2 3ee9ebdf+26-14

db: fixed Delphi compilation and other DuckDB issues

Impact

Delphi can compile the new time constant, INTERVAL text no longer writes through the wrong destination, and DuckDB VARCHAR values used as numeric or date fallbacks are read from the requested row. FPC behavior remains source-compatible.

Arnaud Bouchez · 18:45 UTC · view the commit on GitHub →

11 Low TFastReader can inspect 2, 4 or 8 bytes without advancing mormot.core.buffers adds TFastReader.Peek2, Peek4 and Peek8. Each method checks that the requested bytes remain, calls ErrorOverflow otherwise and reads the unsigned value without incrementing P. New features mormot.core.buffers 5f7fba74+32-2

core: new TFastReader.Peek2/4/8 methods

Impact

Parsers can inspect fixed-width values without saving and restoring the reader position. Existing behavior is unchanged for Delphi and FPC code that does not call the new methods.

Public API

  • TFastReader.Peek2/Peek4/Peek8added — Adds non-consuming unsigned reads with bounds checking.

Arnaud Bouchez · 16:17 UTC · view the commit on GitHub →

12 Low SetBitPtr can now set or clear a selected bit mormot.core.base keeps the existing two-argument SetBitPtr as an overload and adds SetBitPtr(Bits, aIndex, aSet). The new overload updates the selected 32-bit word with OR when aSet is true and AND NOT when false. New features mormot.core.base f02460a4+20-3

core: new SetBitPtr() function

Impact

Low-level callers can update a bit from a Boolean without branching around separate set and clear routines. The existing SetBitPtr call remains source-compatible under Delphi and FPC.

Public API

  • SetBitPtr(pointer, PtrInt, boolean)added — Adds an overload that sets or clears according to aSet.

Arnaud Bouchez · 16:16 UTC · view the commit on GitHub →

13 Low Loaded libraries can report their filename without the path TSynLibrary in mormot.core.os gains LibraryName, which returns ExtractFileName(fLibraryPath) and returns an empty filename when the instance or path is empty. A related test comment is clarified. New features mormot.core.os+1 4be91019+14-3

core: new TSynLibrary.LibraryName function

Impact

Application code can display or log the loaded library's basename without parsing LibraryPath itself. Existing Delphi and FPC code is unaffected.

Public API

  • TSynLibrary.LibraryNameadded — Returns the filename component of LibraryPath.

Arnaud Bouchez · 16:17 UTC · view the commit on GitHub →

14 Low Windows signature status ordering is normalized mormot.core.os.security moves wvsError from the first to the last member of TWinVerifyStatus, names the wintrust.dll constant and tidies the WinVerifyTrust result constants and delayed-load call. Symbolic case handling remains unchanged. Compiler & platform mormot.core.os.security 27c19efd+25-24

core: some minor WinVerifyExeSignature() #699 refactoring

Impact

Code comparing named enum members behaves the same, but persisted, transmitted or integer-cast TWinVerifyStatus values change ordinal meaning. This affects both Delphi and FPC code that relies on enum ordinals.

Worth a look

Check for Ord(TWinVerifyStatus), integer serialization or database storage; migrate stored values to named statuses if present.

Public API

  • TWinVerifyStatusbehaviour-changed — wvsError moves from ordinal 0 to the last ordinal.

Arnaud Bouchez · 08:37 UTC · PR #699 · view the commit on GitHub →

15 Low DuckDB library version is cached and raw helpers are streamlined TDuckDBLib.Version changes from a method to a RawUtf8 field filled by the constructor. The raw unit adds inline annotations, simplifies TIME_TZ formatting and factors DuckDB child-type allocation into DuckDBInitChildren. A test variable is scoped to OSWINDOWS. Under the hood mormot.db.raw.duckdb caf708c0+53-49

db: some DuckDB raw unit refactoring

Impact

Normal library loading and version reporting retain the same value. Direct code that explicitly calls Version() with parentheses may need to switch to field access; other Delphi and FPC application code is unaffected.

Worth a look

Compile any direct TDuckDBLib.Version() calls and use TDuckDBLib.Version field access if the compiler rejects the old method syntax.

Public API

  • TDuckDBLib.Versionsignature-changed — The function becomes a constructor-populated RawUtf8 field.

Arnaud Bouchez · 09:40 UTC · view the commit on GitHub →

16 Low DuckDB tests cover both appender and fallback batch paths The DuckDB and external database tests are reorganized to exercise appender-backed and regular multi-value batches, add UTF-8 checks and guard a missing previous model. The commit also changes the internal HTTP_CONTINUE_RESPONSE constant type to TShort31 and makes formatting-only core edits. Tests mormot.core.base+1 9e78139f+47-50

tests: some fixes

Impact

No application-facing behavior changes are established by this commit. It broadens regression coverage for the DuckDB paths changed elsewhere in the edition.

Arnaud Bouchez · 16:31 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