Styxis
Company
Knowledge

Restore expression objects before accepting a DuckDB export as recoverable

Restore schemas containing COLLATE and subscripts into a separate database. Distinguishing export completion, SQL parse success, and restored values identifies the first failing recovery boundary.

Export and restore are separate

Export completion does not prove schema recoverability. Objects containing expressions must survive reparsing and restoration. Truthound Core can compare operator-recorded restore outcomes with the independent requirement that valid original objects remain usable. [1, 2, 3]

A missing-parentheses report

DuckDB issue #27994 reports SQL ToString omitting parentheses around a COLLATE expression before a subscript in 2.0. EXPORT DATABASE then writes schema.sql that IMPORT DATABASE cannot read back. The issue concerns exported definitions even though the original expression executes. [1]

Restore into a separate database

Restore into a separate database, including macros and views combining COLLATE and subscripting. Compare object inventory and returned values with the original. Retain exported SQL and parse errors instead of treating existing data files as a successful restore. [1, 3]

Parsing precedes value parity

The original expression ('abc' COLLATE nocase)[1] parses and returns a. The first illustrative acceptance condition is restored_parseable=true. true passes that first boundary and still requires checking a; false fails regardless of the data files. SQL text need not match byte for byte. [1, 3]

The operator invokes the parser

ColumnPairValidator in Truthound Core Python SDK 3.3.2 can compare prepared parseability Booleans with an expected true value. The operator runs the restore and records its status. The SDK does not invoke DuckDB’s parser or add missing parentheses. [1, 2, 3]

Recheck the complete recovery

Isolate failed objects during a restore rehearsal. If an operator chooses a verified replacement definition, repeat the complete object and data checks rather than inferring overall recovery from that one repaired macro. [1, 3]

Three distinct completion claims

Separate export success, schema parseability, and restored value parity in the completion record. They answer different recovery questions, and the earliest failure tells the operator which evidence is still missing. [1, 3]

Application conditions

Prepare actual separate-database restore results and the original object inventory.

Alternatives

Isolate failed objects and recheck complete restoration after a replacement definition.

Limitations

  • A parse pass does not guarantee returned values or complete data recovery.

Evidence

Event checked
Subject checked
Modified