Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0bce1dc
feat(coverage): link a function call to the form of its overload by a…
kvlonge Nov 30, 2026
63c2c47
fix(postgres): word effect refusals so they read from convert scripts
kvlonge Nov 30, 2026
e7567ca
chore(postgres): sign the reviewed not-translatable groups and return…
kvlonge Nov 30, 2026
da23d02
feat(postgres): convert the float8 math functions and PostgreSQL's de…
kvlonge Nov 30, 2026
40c5de9
feat(postgres): convert regexp_match, the regex and text splits and t…
kvlonge Nov 30, 2026
df583ed
feat(postgres): convert substring with a SIMILAR pattern and its escape
kvlonge Nov 30, 2026
1bc7143
feat(postgres): convert json_strip_nulls, jsonb_strip_nulls and jsonb…
kvlonge Nov 30, 2026
395621f
feat(postgres): convert uuid_extract_timestamp, num_nulls and num_non…
kvlonge Nov 30, 2026
d6bba9f
feat(postgres): convert extract of a timestamp's rising fields, raisi…
kvlonge Nov 30, 2026
00d3954
feat(postgres): convert convert_from, convert_to and convert for UTF8…
kvlonge Nov 30, 2026
a4861db
fix(postgres): refuse a one-argument substring of a bit string as Pos…
kvlonge Nov 30, 2026
f20ab34
feat(postgres): convert quote_ident and parse_ident of unquoted ident…
kvlonge Nov 30, 2026
b0d315e
feat(coverage): let a results links file leave row-order-dependent ca…
kvlonge Nov 30, 2026
b264456
refactor(postgres): name the float functions' thresholds, and update …
kvlonge Nov 30, 2026
e3bd55a
feat(evidence): let a policy name the divergence a recorded case expects
kvlonge Nov 30, 2026
5ae2a67
feat(evidence): read PostgreSQL's duplicate JSON object key error as …
kvlonge Nov 30, 2026
221f4ff
feat(postgres): convert array_agg, any_value, string_agg and the JSON…
kvlonge Nov 30, 2026
c3c7131
fix(postgres): convert string_agg(DISTINCT) ordered by its value
kvlonge Nov 30, 2026
71b9e1b
test(postgres): record ordered aggregate cases and credit the unorder…
kvlonge Nov 30, 2026
a6db6ac
feat(postgres): convert div of numerics and reject unary minus of non…
kvlonge Nov 30, 2026
7b031b7
refactor(postgres): refuse collected aggregates over a window in the …
kvlonge Nov 30, 2026
ae68e84
fix(postgres): refuse json_strip_nulls rewrites, char(n) and untyped …
kvlonge Nov 30, 2026
4b666a4
fix(coverage): link and check uncredited statements like any other, a…
kvlonge Nov 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions coverage/translation-postgres/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ file lists only what differs.
case's own query, not from the input fixture every case shares (`WITH input AS (SELECT * FROM
(VALUES …) AS input(ordinal, …))`). A statement the PostgreSQL parser cannot read links to no form.
- `form-links.toml`: how operators, clauses, casts, lexical spellings and the query shell link to
forms. Function calls link by name. Spelling keys are read with PostgreSQL's own scanner, because
forms. Function calls link by name, and `argument-types.toml` sends a converted call to the
overload its first argument's type picks, such as `length` of `text` to the string form and not
the bytea, bit, geometry or tsvector ones; a call the converter refused links by name. Spelling keys are read with PostgreSQL's own scanner, because
the shared tree reads several spellings as one: `E'…'`, `U&'…'` and `'…'` strings, `SOME` and `ANY`,
`float(p)` and `real`, and every operator PostgreSQL names itself, such as `&` and `#`. An operator
written the same way for integers and bit strings links to both forms. The scanner also keys the
Expand All @@ -43,8 +45,9 @@ file lists only what differs.
documented statement form each one is (`spelling:stmt_*`), its serial column types and its
schema-qualified names, since one statement node covers several forms.
`uncounted_statements` in the policy names `TRUNCATE TABLE`, whose command tag carries no count.
- `not-translatable.toml`: eleven groups, each unsigned until a reviewer signs it off in
`reviews/results.toml`.
- `not-translatable.toml`: eight groups, signed off in `reviews/results.toml`. The geometric,
network and range types are not in a group: each is a fixed algorithm DuckDB can compute, so
their forms count as translatable.
- `obligations/<family>.toml`: one obligation per generated type-combination, NULL-argument and
error-parity case, and per effect case, of a live catalogue form, written from the cases' tags by
`scripts/build_translation_obligations_postgres.py`; `make translation-files` fails when a
Expand Down
240 changes: 240 additions & 0 deletions coverage/translation-postgres/argument-types.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
# For function names several PostgreSQL forms share, the type families each form's first argument
# takes, as the PostgreSQL converter names them (an array's family starts with `_`; UNKNOWN is an
# untyped NULL, which PostgreSQL resolves to text). A call whose first argument has a family links
# only to the forms listing it; a statement that records no call of the name links by name alone.

[[form]]
id = "pg.functions.array.unnest"
first = ["_INT4", "_TEXT"]

[[form]]
id = "pg.functions.binarystring.bit-count"
first = ["BYTEA"]

[[form]]
id = "pg.functions.binarystring.bit-length"
first = ["BYTEA"]

[[form]]
id = "pg.functions.binarystring.btrim"
first = ["BYTEA"]

[[form]]
id = "pg.functions.binarystring.get-bit"
first = ["BYTEA"]

[[form]]
id = "pg.functions.binarystring.length"
first = ["BYTEA"]

[[form]]
id = "pg.functions.binarystring.ltrim"
first = ["BYTEA"]

[[form]]
id = "pg.functions.binarystring.md5"
first = ["BYTEA"]

[[form]]
id = "pg.functions.binarystring.octet-length"
first = ["BYTEA"]

[[form]]
id = "pg.functions.binarystring.overlay-placing-from"
first = ["BYTEA"]

[[form]]
id = "pg.functions.binarystring.position-in"
first = ["BYTEA"]

[[form]]
id = "pg.functions.binarystring.reverse"
first = ["BYTEA"]

[[form]]
id = "pg.functions.binarystring.rtrim"
first = ["BYTEA"]

[[form]]
id = "pg.functions.binarystring.set-bit"
first = ["BYTEA"]

[[form]]
id = "pg.functions.binarystring.substr"
first = ["BYTEA"]

[[form]]
id = "pg.functions.binarystring.substring"
first = ["BYTEA"]

[[form]]
id = "pg.functions.binarystring.trim"
first = ["BYTEA"]

[[form]]
id = "pg.functions.binarystring.trim-from"
first = ["BYTEA"]

[[form]]
id = "pg.functions.bitstring.bit-count"
first = ["BIT", "VARBIT"]

[[form]]
id = "pg.functions.bitstring.bit-length"
first = ["BIT", "VARBIT"]

[[form]]
id = "pg.functions.bitstring.get-bit"
first = ["BIT", "VARBIT"]

[[form]]
id = "pg.functions.bitstring.length"
first = ["BIT", "VARBIT"]

[[form]]
id = "pg.functions.bitstring.octet-length"
first = ["BIT", "VARBIT"]

[[form]]
id = "pg.functions.bitstring.overlay-placing-from"
first = ["BIT", "VARBIT"]

[[form]]
id = "pg.functions.bitstring.position-in"
first = ["BIT", "VARBIT"]

[[form]]
id = "pg.functions.bitstring.set-bit"
first = ["BIT", "VARBIT"]

[[form]]
id = "pg.functions.bitstring.substring"
first = ["BIT", "VARBIT"]

[[form]]
id = "pg.functions.datetime.age"
first = ["TIMESTAMP", "TIMESTAMPTZ", "DATE"]

[[form]]
id = "pg.functions.datetime.to-timestamp"
first = ["INT2", "INT4", "INT8", "NUMERIC", "FLOAT4", "FLOAT8", "UNKNOWN"]

[[form]]
id = "pg.functions.formatting.to-timestamp"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.geometry.length"
first = ["LSEG", "PATH"]

[[form]]
id = "pg.functions.info.age"
first = ["XID"]

[[form]]
id = "pg.functions.matching.substring"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.math.trunc"
first = ["INT2", "INT4", "INT8", "NUMERIC", "FLOAT4", "FLOAT8"]

[[form]]
id = "pg.functions.net.trunc"
first = ["MACADDR", "MACADDR8"]

[[form]]
id = "pg.functions.range.lower"
first = ["INT4RANGE", "INT8RANGE", "NUMRANGE", "TSRANGE", "TSTZRANGE", "DATERANGE", "INT4MULTIRANGE", "INT8MULTIRANGE", "NUMMULTIRANGE", "TSMULTIRANGE", "TSTZMULTIRANGE", "DATEMULTIRANGE"]

[[form]]
id = "pg.functions.range.unnest"
first = ["INT4MULTIRANGE", "INT8MULTIRANGE", "NUMMULTIRANGE", "TSMULTIRANGE", "TSTZMULTIRANGE", "DATEMULTIRANGE"]

[[form]]
id = "pg.functions.range.upper"
first = ["INT4RANGE", "INT8RANGE", "NUMRANGE", "TSRANGE", "TSTZRANGE", "DATERANGE", "INT4MULTIRANGE", "INT8MULTIRANGE", "NUMMULTIRANGE", "TSMULTIRANGE", "TSTZMULTIRANGE", "DATEMULTIRANGE"]

[[form]]
id = "pg.functions.string.bit-length"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.btrim"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.length"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.lower"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.ltrim"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.md5"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.octet-length"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.overlay-placing-from"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.position-in"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.reverse"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.rtrim"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.substr"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.substring"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.substring-from"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.substring-from-for"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.substring-similar-escape"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.trim"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.trim-from"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.string.upper"
first = ["TEXT", "VARCHAR", "BPCHAR", "NAME", "UNKNOWN"]

[[form]]
id = "pg.functions.textsearch.length"
first = ["TSVECTOR"]

[[form]]
id = "pg.functions.textsearch.unnest"
first = ["TSVECTOR"]
14 changes: 14 additions & 0 deletions coverage/translation-postgres/form-links.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1326,3 +1326,17 @@ reason = "The WHEN clauses are part of the MERGE form, which links by node:merge
[[no_form]]
constructs = ["spelling:positional_column"]
reason = "A $n parameter is the positional-parameter form, which links by node:parameter."

# These cases aggregate rows in no stated order, so PostgreSQL's recorded answer is one of several it may
# give. Each is recorded and raises aggregate_row_order; an ordered case of the same form stands in for it.
[[uncredited]]
reason = "unspecified_row_order"
cases = [
"translation/functions/aggregate.any-value.toml#t001_types_1",
"translation/functions/aggregate.json-agg-strict.toml#t001_types_1",
"translation/functions/aggregate.json-object-agg-strict.toml#t001_types_1",
"translation/functions/aggregate.json-object-agg-unique-strict.toml#t001_types_1",
"translation/functions/aggregate.json-object-agg-unique.toml#t001_types_1",
"translation/functions/aggregate.jsonb-agg-strict.toml#t001_types_1",
"translation/functions/aggregate.string-agg.toml#t001_types_1",
]
Loading
Loading