From 15bd5341d2355ad2d94f2938e7c6d13f85370904 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sun, 6 Dec 2026 17:29:53 +0000 Subject: [PATCH 1/5] fix(postgres): name the copied list's second column in COPY's FORCE NOT NULL list The legacy COPY form's reading writes the FORCE NOT NULL list's second item out, and with distinct list items it was numbered past the copied list's columns, naming c3, which COPY does not copy. The item now has its own placeholder, filled with c2. The eleven obligations whose targets spell the item move to new ids, and the reading's NOT suppression follows the new target. --- coverage/syntax-postgres/limits.toml | 6 +- coverage/syntax-postgres/obligations/dml.toml | 64 ++++++++++++------- coverage/syntax-postgres/retired.toml | 17 +++++ .../syntax_obligations_postgres/constants.py | 1 + 4 files changed, 61 insertions(+), 27 deletions(-) diff --git a/coverage/syntax-postgres/limits.toml b/coverage/syntax-postgres/limits.toml index dd39d57808..95cabc3ced 100644 --- a/coverage/syntax-postgres/limits.toml +++ b/coverage/syntax-postgres/limits.toml @@ -552,8 +552,8 @@ reason = "DEFAULT VALUES takes no column list and no OVERRIDING clause (gram.y i [[reading]] form = "pg.dml.copy.pre-9-0-from" grammar_sha256 = "c8baca9f8e5e0bbf5d8a01095746e1cf206be5cbab9fb0d5256c1464eabf7c5d" -grammar = ["COPY [ ( [, ...] ) ] FROM { '' | STDIN } [ [ WITH ] [ BINARY ] [ DELIMITER [ AS ] '' ] [ NULL [ AS ] '' ] [ CSV [ HEADER ] [ QUOTE [ AS ] '' ] [ ESCAPE [ AS ] '' ] [ FORCE NOT NULL [ , ] ] ] ]"] -reason = "the FORCE NOT NULL column list's second item written out, which the renderer otherwise copies with its keywords" +grammar = ["COPY [ ( [, ...] ) ] FROM { '' | STDIN } [ [ WITH ] [ BINARY ] [ DELIMITER [ AS ] '' ] [ NULL [ AS ] '' ] [ CSV [ HEADER ] [ QUOTE [ AS ] '' ] [ ESCAPE [ AS ] '' ] [ FORCE NOT NULL [ , ] ] ] ]"] +reason = "the FORCE NOT NULL column list's second item written out, which the renderer otherwise copies with its keywords, naming the copied list's second column, since FORCE NOT NULL takes only columns COPY copies" # Derived negatives that are valid PostgreSQL, across the query and dml families. @@ -630,7 +630,7 @@ reason = "AS after NULL is optional in COPY's option list (gram.y copy_opt_item: form = "pg.dml.copy.pre-9-0-from" kind = "negative_neighbour" target = "" -note = "the form without its required NOT in [ FORCE NOT NULL [ , ] ]" +note = "the form without its required NOT in [ FORCE NOT NULL [ , ] ]" reason = "without NOT, FORCE NULL column_list is the current COPY option of that name, which the legacy option list also parses (gram.y copy_opt_item)" diff --git a/coverage/syntax-postgres/obligations/dml.toml b/coverage/syntax-postgres/obligations/dml.toml index 044afb826a..8047fb92dc 100644 --- a/coverage/syntax-postgres/obligations/dml.toml +++ b/coverage/syntax-postgres/obligations/dml.toml @@ -1080,70 +1080,70 @@ target = "'' in [ ESCAPE [ AS ] '' ]" note = "an unquoted identifier in place of ''" [[obligation]] -id = "pg.dml.copy.pre-9-0-from.o071" +id = "pg.dml.copy.pre-9-0-from.o083" kind = "option_present" required = true -target = "[ FORCE NOT NULL [ , ] ]" +target = "[ FORCE NOT NULL [ , ] ]" [[obligation]] -id = "pg.dml.copy.pre-9-0-from.o072" +id = "pg.dml.copy.pre-9-0-from.o084" kind = "option_absent" required = true -target = "[ FORCE NOT NULL [ , ] ]" +target = "[ FORCE NOT NULL [ , ] ]" [[obligation]] -id = "pg.dml.copy.pre-9-0-from.o073" +id = "pg.dml.copy.pre-9-0-from.o085" kind = "required_operand_missing" required = true -target = " in [ FORCE NOT NULL [ , ] ]" +target = " in [ FORCE NOT NULL [ , ] ]" note = "omit " [[obligation]] -id = "pg.dml.copy.pre-9-0-from.o074" +id = "pg.dml.copy.pre-9-0-from.o086" kind = "operand_type_class" required = true -target = " in [ FORCE NOT NULL [ , ] ]" +target = " in [ FORCE NOT NULL [ , ] ]" note = "a valid identifier" [[obligation]] -id = "pg.dml.copy.pre-9-0-from.o075" +id = "pg.dml.copy.pre-9-0-from.o087" kind = "negative_neighbour" required = true -target = " in [ FORCE NOT NULL [ , ] ]" +target = " in [ FORCE NOT NULL [ , ] ]" note = "a string literal in place of " [[obligation]] -id = "pg.dml.copy.pre-9-0-from.o076" +id = "pg.dml.copy.pre-9-0-from.o088" kind = "option_present" required = true -target = "[ , ]" +target = "[ , ]" [[obligation]] -id = "pg.dml.copy.pre-9-0-from.o077" +id = "pg.dml.copy.pre-9-0-from.o089" kind = "option_absent" required = true -target = "[ , ]" +target = "[ , ]" [[obligation]] -id = "pg.dml.copy.pre-9-0-from.o078" +id = "pg.dml.copy.pre-9-0-from.o090" kind = "required_operand_missing" required = true -target = " in [ , ]" -note = "omit " +target = " in [ , ]" +note = "omit " [[obligation]] -id = "pg.dml.copy.pre-9-0-from.o079" +id = "pg.dml.copy.pre-9-0-from.o091" kind = "operand_type_class" required = true -target = " in [ , ]" +target = " in [ , ]" note = "a valid identifier" [[obligation]] -id = "pg.dml.copy.pre-9-0-from.o080" +id = "pg.dml.copy.pre-9-0-from.o092" kind = "negative_neighbour" required = true -target = " in [ , ]" -note = "a string literal in place of " +target = " in [ , ]" +note = "a string literal in place of " [[obligation]] id = "pg.dml.copy.pre-9-0-from.o061" @@ -1164,10 +1164,10 @@ required = true note = "the form without its required { '' | STDIN }" [[obligation]] -id = "pg.dml.copy.pre-9-0-from.o082" +id = "pg.dml.copy.pre-9-0-from.o093" kind = "negative_neighbour" required = true -note = "the form without its required NULL in [ FORCE NOT NULL [ , ] ]" +note = "the form without its required NULL in [ FORCE NOT NULL [ , ] ]" [[obligation]] id = "pg.dml.copy.pre-9-0-from.o066" @@ -1207,6 +1207,22 @@ target = "" anchor = "doc.identifiers-syntax" note = "reserved: a reserved keyword, unquoted (expected rejection) and double-quoted (expected acceptance)" +[[obligation]] +id = "pg.dml.copy.pre-9-0-from.o094" +kind = "identifier_class" +required = true +target = "" +anchor = "doc.identifiers-syntax" +note = "quoted: a double-quoted identifier with blanks and mixed case" + +[[obligation]] +id = "pg.dml.copy.pre-9-0-from.o095" +kind = "identifier_class" +required = true +target = "" +anchor = "doc.identifiers-syntax" +note = "reserved: a reserved keyword, unquoted (expected rejection) and double-quoted (expected acceptance)" + [[obligation]] id = "pg.dml.copy.pre-9-0-to.o001" kind = "positive" diff --git a/coverage/syntax-postgres/retired.toml b/coverage/syntax-postgres/retired.toml index 320f7e4ddb..9b17e200cc 100644 --- a/coverage/syntax-postgres/retired.toml +++ b/coverage/syntax-postgres/retired.toml @@ -3715,3 +3715,20 @@ ids = [ "pg.ddl.alter-type.drop-attribute.o029", "pg.ddl.alter-type.drop-attribute.o030", ] + +[[retired]] +retired_in = "fix/postgres-copy-force-not-null" +reason = "the FORCE NOT NULL list's written-out second item now names the copied list's second column, so every obligation whose target spells that item moved to a new id" +ids = [ + "pg.dml.copy.pre-9-0-from.o071", + "pg.dml.copy.pre-9-0-from.o072", + "pg.dml.copy.pre-9-0-from.o073", + "pg.dml.copy.pre-9-0-from.o074", + "pg.dml.copy.pre-9-0-from.o075", + "pg.dml.copy.pre-9-0-from.o076", + "pg.dml.copy.pre-9-0-from.o077", + "pg.dml.copy.pre-9-0-from.o078", + "pg.dml.copy.pre-9-0-from.o079", + "pg.dml.copy.pre-9-0-from.o080", + "pg.dml.copy.pre-9-0-from.o082", +] diff --git a/scripts/syntax_obligations_postgres/constants.py b/scripts/syntax_obligations_postgres/constants.py index de837faa33..9375dc7774 100644 --- a/scripts/syntax_obligations_postgres/constants.py +++ b/scripts/syntax_obligations_postgres/constants.py @@ -239,6 +239,7 @@ '"char"[]': "'{a}'", } FORM_FILLS: dict[str, dict[str, str]] = { + "pg.dml.copy.pre-9-0-from": {"copied_column_name": "c2"}, "pg.functions.aggregate.grouping": {"group_by_expression(s)": "c"}, "pg.functions.json.json-to-record": {"json": "JSON '{\"a\":1}'"}, "pg.functions.json.json-to-recordset": {"json": "JSON '[{\"a\":1}]'"}, From 2f5e847a456ec414af18b5c19b1d647edaaca61c Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sun, 6 Dec 2026 17:32:45 +0000 Subject: [PATCH 2/5] fix(postgres): record the retiring commit for the FORCE NOT NULL ids --- coverage/syntax-postgres/retired.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coverage/syntax-postgres/retired.toml b/coverage/syntax-postgres/retired.toml index 9b17e200cc..5ddabdfc98 100644 --- a/coverage/syntax-postgres/retired.toml +++ b/coverage/syntax-postgres/retired.toml @@ -3717,7 +3717,7 @@ ids = [ ] [[retired]] -retired_in = "fix/postgres-copy-force-not-null" +retired_in = "15bd5341d2355ad2d94f2938e7c6d13f85370904" reason = "the FORCE NOT NULL list's written-out second item now names the copied list's second column, so every obligation whose target spells that item moved to a new id" ids = [ "pg.dml.copy.pre-9-0-from.o071", From 88a4bd078101066edb2b84b1ab64063afa267f78 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sun, 6 Dec 2026 17:46:25 +0000 Subject: [PATCH 3/5] chore(coverage): pin PostgreSQL evidence with the COPY FORCE NOT NULL cases The reading's reason now states the copied-column restriction as the server's observed refusal (42P10) rather than as something the page documents. --- coverage/syntax-postgres/limits.toml | 2 +- evidence.toml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coverage/syntax-postgres/limits.toml b/coverage/syntax-postgres/limits.toml index 95cabc3ced..c94f1d5a83 100644 --- a/coverage/syntax-postgres/limits.toml +++ b/coverage/syntax-postgres/limits.toml @@ -553,7 +553,7 @@ reason = "DEFAULT VALUES takes no column list and no OVERRIDING clause (gram.y i form = "pg.dml.copy.pre-9-0-from" grammar_sha256 = "c8baca9f8e5e0bbf5d8a01095746e1cf206be5cbab9fb0d5256c1464eabf7c5d" grammar = ["COPY [ ( [, ...] ) ] FROM { '' | STDIN } [ [ WITH ] [ BINARY ] [ DELIMITER [ AS ] '' ] [ NULL [ AS ] '' ] [ CSV [ HEADER ] [ QUOTE [ AS ] '' ] [ ESCAPE [ AS ] '' ] [ FORCE NOT NULL [ , ] ] ] ]"] -reason = "the FORCE NOT NULL column list's second item written out, which the renderer otherwise copies with its keywords, naming the copied list's second column, since FORCE NOT NULL takes only columns COPY copies" +reason = "the FORCE NOT NULL column list's second item written out, which the renderer otherwise copies with its keywords, naming the copied list's second column; the page does not say which columns FORCE NOT NULL may name, but postgres:18.6 refuses one COPY does not copy (observed: 42P10, FORCE_NOT_NULL column \"c3\" not referenced by COPY)" # Derived negatives that are valid PostgreSQL, across the query and dml families. diff --git a/evidence.toml b/evidence.toml index 5a24bec450..eb8b269219 100644 --- a/evidence.toml +++ b/evidence.toml @@ -20,8 +20,8 @@ commit = "fa4ccd4dc55cb2d1fb2d37236c35b8b755045001" content_sha256 = "f13351d7a05110c9eb509d3db70557bf4bae66eae0c129b05d65e6a04d540783" [pins.postgres] -commit = "6178ce4134a25aed24f8f4cdfac1f9df8b270ec3" -content_sha256 = "0e387d19fbebfe8ff7f273e8837e1f0902b3622729d38e2660d3cbc1e9f4f1de" +commit = "6d4a57ee1d6d70023904e106ff7cf7e5d51bbcb7" +content_sha256 = "019db3ba4b26c12fbf3d8a92f4d43b46a1fa58d68a10f2bd9de0278f5153b241" [pins.snowflake] commit = "9c471bfeb654c7283a28804d15c3ea26ab0b8ac9" From b1452a7ccb21eaea29510df58d10c08e8c6c3642 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sun, 6 Dec 2026 17:50:33 +0000 Subject: [PATCH 4/5] review(postgres): re-read COPY pre-9.0 FROM after the FORCE NOT NULL fix Approves pg.dml.copy.pre-9-0-from against the pinned sql-copy page and the evidence pin 6d4a57ee, with every required obligation met. --- coverage/syntax-postgres/reviews/dml.toml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/coverage/syntax-postgres/reviews/dml.toml b/coverage/syntax-postgres/reviews/dml.toml index 5c064ba1d7..7de15130b5 100644 --- a/coverage/syntax-postgres/reviews/dml.toml +++ b/coverage/syntax-postgres/reviews/dml.toml @@ -369,3 +369,20 @@ note = "Re-read after copied list names were counted as written, against evidenc "pg.dml.copy.pre-9-0-from" = "bcda80f9d1e52716c42d1dbafea4eb5ac39e2bd984367fb13afef1683c21cd89" "pg.dml.insert" = "952e8ecca0bb4eedbc3262f6391accd4427ffb81c8e055fe3fff7b1255611820" "pg.dml.update" = "a4f255013191486714d6cb557241f5a93ed78ba8725bc044cdad85d6fd930534" + +[[review]] +id = "pg-dml-018" +family = "dml" +parser_tree = "d6759f282230512069bfcf3bdc3b7b8e221f1b9e" +reviewed_utc = "2026-12-06T17:49:25Z" +verdict = "approved" +forms = [ + "pg.dml.copy.pre-9-0-from", +] +note = "Re-read after FORCE NOT NULL's list was given its own second placeholder, against evidence 6d4a57ee (the merge of 3b0a3bf6, same PostgreSQL tree) and the pinned sql-copy page, whose Compatibility synopsis for COPY FROM reads [ CSV ... [ FORCE NOT NULL column_name [, ...] ] ]. The reading writes the list's second item out as , which means the same as the page's [, ...] and adds no keyword. The all-options accept case now ends ( c1 , c2 ) ... FORCE NOT NULL c1 , c2, naming only columns inside the copied list, which resolves the c3 note on pg-dml-017; it combines BINARY with CSV and DELIMITER, so it rests on the parse alone, as before, and its receipt stops at relation t1 does not exist. Single-item FORCE NOT NULL c1, and the quoted (\"c2 Q\") and quoted reserved (\"SELECT\") second items without a column list, are accepted up to the same missing table. PostgreSQL refuses each neighbour as a syntax error: FORCE NOT NULL with no column, a trailing comma, a string literal ('v1') as either item, an unquoted reserved word (SELECT) as the second item, and FORCE NOT without NULL. The 11 obligations against the old item are retired in one group and reissued under new ids; all 74 required obligations are met. That FORCE NOT NULL takes only copied columns is a server check (42P10, FORCE_NOT_NULL column not referenced by COPY), not something the page documents; the limit's reason now says so, and no recorded receipt reaches that check. The earlier approval (pg-dml-017) stands." + +[review.fingerprints] +"pg.dml.copy.pre-9-0-from" = "0cdf2478f5933a7f8634d3a3ffd929da99f84bb6a149f3dac539ed03e97d6ead" + +[review.definitions] +"pg.dml.copy.pre-9-0-from" = "64cb82ab61f01144ddfceacf07d744f76d41ad6ee5a4f5203be9b5b342a7abe7" From 9b6e179dd272d460d11ee2f4bd3fcd3f93250951 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Sun, 6 Dec 2026 18:46:04 +0000 Subject: [PATCH 5/5] chore(coverage): re-record the PostgreSQL baseline for the COPY FORCE NOT NULL obligations --- coverage/syntax-postgres/baseline.json | 31 +++++++++++++++----------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/coverage/syntax-postgres/baseline.json b/coverage/syntax-postgres/baseline.json index 414fb3e716..25bc10d71b 100644 --- a/coverage/syntax-postgres/baseline.json +++ b/coverage/syntax-postgres/baseline.json @@ -13272,17 +13272,19 @@ "pg.dml.copy.pre-9-0-from.o068", "pg.dml.copy.pre-9-0-from.o069", "pg.dml.copy.pre-9-0-from.o070", - "pg.dml.copy.pre-9-0-from.o071", - "pg.dml.copy.pre-9-0-from.o072", - "pg.dml.copy.pre-9-0-from.o073", - "pg.dml.copy.pre-9-0-from.o074", - "pg.dml.copy.pre-9-0-from.o075", - "pg.dml.copy.pre-9-0-from.o076", - "pg.dml.copy.pre-9-0-from.o077", - "pg.dml.copy.pre-9-0-from.o078", - "pg.dml.copy.pre-9-0-from.o079", - "pg.dml.copy.pre-9-0-from.o080", - "pg.dml.copy.pre-9-0-from.o082", + "pg.dml.copy.pre-9-0-from.o083", + "pg.dml.copy.pre-9-0-from.o084", + "pg.dml.copy.pre-9-0-from.o085", + "pg.dml.copy.pre-9-0-from.o086", + "pg.dml.copy.pre-9-0-from.o087", + "pg.dml.copy.pre-9-0-from.o088", + "pg.dml.copy.pre-9-0-from.o089", + "pg.dml.copy.pre-9-0-from.o090", + "pg.dml.copy.pre-9-0-from.o091", + "pg.dml.copy.pre-9-0-from.o092", + "pg.dml.copy.pre-9-0-from.o093", + "pg.dml.copy.pre-9-0-from.o094", + "pg.dml.copy.pre-9-0-from.o095", "pg.dml.copy.pre-9-0-to.o001", "pg.dml.copy.pre-9-0-to.o002", "pg.dml.copy.pre-9-0-to.o003", @@ -28665,11 +28667,13 @@ "pg.dml.copy.pre-7-3-to.kd5017c9a2d17", "pg.dml.copy.pre-9-0-from.k2964aacf83e2", "pg.dml.copy.pre-9-0-from.k2e7068022853", + "pg.dml.copy.pre-9-0-from.k3b4c245dec29", "pg.dml.copy.pre-9-0-from.k50f931ee510a", + "pg.dml.copy.pre-9-0-from.k5454e8d242cf", "pg.dml.copy.pre-9-0-from.k6b86491468a1", - "pg.dml.copy.pre-9-0-from.k82c3472d9e24", "pg.dml.copy.pre-9-0-from.kcf6f139a27bd", "pg.dml.copy.pre-9-0-from.kd5f5b4aa64cf", + "pg.dml.copy.pre-9-0-from.kebf30e6459df", "pg.dml.copy.pre-9-0-to.k11ab3a55b887", "pg.dml.copy.pre-9-0-to.k26867824b694", "pg.dml.copy.pre-9-0-to.k2f379917240a", @@ -36788,6 +36792,7 @@ "pg.dml.copy.pre-7-3-to.kff5b5a92868f", "pg.dml.copy.pre-9-0-from.k017e6e3dca81", "pg.dml.copy.pre-9-0-from.k2bab96497eae", + "pg.dml.copy.pre-9-0-from.k39aa30a05292", "pg.dml.copy.pre-9-0-from.k47377c2ebb78", "pg.dml.copy.pre-9-0-from.k6a3db6aed162", "pg.dml.copy.pre-9-0-from.k84e59bfe8f20", @@ -41550,7 +41555,7 @@ "pg.dml.copy.from.ke23cb998ea17", "pg.dml.copy.pre-9-0-from.k02bc79181aa5", "pg.dml.copy.pre-9-0-from.k5419ef07a47f", - "pg.dml.copy.pre-9-0-from.k5454e8d242cf", + "pg.dml.copy.pre-9-0-from.k82c3472d9e24", "pg.dml.copy.pre-9-0-to.k14349b203460", "pg.dml.copy.to.k34f37b162ad2", "pg.dml.delete.k02ab0cda496c",