Skip to content

feat(postgres): translate math, string, JSON and row-order aggregate forms to DuckDB - #351

Merged
kvlonge merged 23 commits into
mainfrom
feat/postgres-translation-split
Nov 30, 2026
Merged

kvlonge merged 23 commits into
mainfrom
feat/postgres-translation-split

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Why

First of four PostgreSQL translation PRs: more PostgreSQL 18.6 forms convert to DuckDB and match the recorded results. The PostgreSQL measure rises from 393 to 462 of 940 translatable forms (+69, forecast 83). Unfinished forms roll into the next PR or carry a named blocker.

Changes

  • Convert the float8 math and degree trigonometry, the regex functions and splits, substring with SIMILAR, json_strip_nulls, jsonb_pretty, uuid_extract_timestamp, num_nulls, extract of rising fields, convert_from/convert_to, quote_ident, parse_ident and div of numerics.
  • array_agg, any_value, string_agg and the JSON aggregates convert in their own ORDER BY. A short guard raises aggregate_row_order where tied rows hold different values; a call ordered by its own value needs none.
  • Coverage: function calls link to the overload their argument type picks. A results links file may list [[uncredited]] cases, with the fixed reason unspecified_row_order. Each listed case must be recorded, must raise that divergence and must have a credited stand-in.
  • Evidence: a policy may name the divergence a recorded case expects in [expected_divergences]. It fails closed on a missing case, an unknown divergence or a case that also declares one. SQLSTATE 22030 reads as an invalid argument.
  • Evidence pinned to 5346407: 28 ordered aggregate cases recorded on PostgreSQL 18.6.
  • Reviewed not-translatable groups signed off.

Verification

  • sqlbabel verify on the PostgreSQL cases: 3,029 cases, 0 failed, 8 diverged as expected.
  • syntax-coverage results: 462 of 940 forms match, nothing regressed, and the baseline is updated. 7 cases are listed as uncredited, each with a stand-in.
  • Probes against PostgreSQL 18.6: div 360 of 360 rows match; quote_ident and parse_ident 566 of 566.
  • Targeted tests, with negative tests for both new tables. SQLite and Databricks measures unchanged.
  • make check-ci passes on this head.

… reasonably translatable forms to the measure
…ses uncredited

An [[uncredited]] table lists recorded cases that count neither for nor
against any form. Its reason is a fixed enum, unspecified_row_order for
now. Each listed case must be recorded and raise the aggregate_row_order
divergence, and each obligation it cites needs an obligation of the same
form and kind citing only credited cases. The report lists the cases and
counts them beside the matching total. Files without the table measure
exactly as before.
An optional [expected_divergences] table maps case references to a
declared divergence, for recorded cases whose append-only file cannot
name it. Verify treats a listed case as if it declared
expected_divergence. Loading fails on a listed case that does not
exist, on an unknown divergence, and on a case that both declares the
field and is listed. Verify prints every case the table lists. Policies
without the table load and verify exactly as before.
… aggregates in their row order

Each converts in its own ORDER BY, behind a guard that raises the
aggregate_row_order divergence where rows tied on every key, or the rows
of an unordered call, hold different values. A call ordered by its own
value needs no guard; jsonb objects guard only a key holding two values.
The generated cases recorded over rows in an unspecified order now
expect that divergence through the policy.
@kvlonge
kvlonge enabled auto-merge November 30, 2026 16:14
@kvlonge
kvlonge added this pull request to the merge queue Nov 30, 2026
Merged via the queue into main with commit 100e435 Nov 30, 2026
10 checks passed
@kvlonge
kvlonge deleted the feat/postgres-translation-split branch November 30, 2026 17:28
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.

1 participant