| From: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Reject REPLICA IDENTITY USING INDEX on column with invalid NOT N |
| Date: | 2026-08-12 17:17:45 |
| Message-ID: | E1wuCaG-00000000I9b-0sN3@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Reject REPLICA IDENTITY USING INDEX on column with invalid NOT NULL
ALTER TABLE ... REPLICA IDENTITY USING INDEX verified key columns by
reading pg_attribute.attnotnull, but commit a379061a22a8 made
attnotnull true also for unvalidated (NOT VALID) not-null constraints,
which do not prove the column null-free. An index over such a column
could thus be marked as replica identity even though the column might
contain NULLs, causing apply-side divergence for UPDATE/DELETE on the
nullable rows.
Fix by additionally requiring convalidated for the underlying
constraint, mirroring the fix d9ffc27291f applied to ATExecAddIdentity
for the analogous identity-column case.
Author: Ante Krešić <ante(at)tigerdata(dot)com>
Reviewed-by: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
Reviewed-by: solai v <solai(dot)cdac(at)gmail(dot)com>
Backpatch-through: 18
Discussion: https://postgr.es/m/CABXQ4dJUibZzN91qvWmsfA7MUDn9YRCNyu3CcukdyokbH1=41Q@mail.gmail.com
Branch
------
REL_19_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/82c86ac6822033cff10a39496925c02ca7adc532
Modified Files
--------------
src/backend/commands/tablecmds.c | 22 ++++++++++++++++++++++
src/test/regress/expected/replica_identity.out | 23 +++++++++++++++++++++++
src/test/regress/sql/replica_identity.sql | 16 ++++++++++++++++
3 files changed, 61 insertions(+)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tomas Vondra | 2026-08-12 18:28:50 | Re: pgsql: Change wal_compression=on to the first of zstd, lz4, pglz |
| Previous Message | Tom Lane | 2026-08-12 16:49:11 | pgsql: Fix float8_regr_accum() for Inf/NaN with constant other input. |