agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Reject REPLICA IDENTITY USING INDEX on column with invalid NOT N
3+ messages / 1 participants
[nested] [flat]

* pgsql: Reject REPLICA IDENTITY USING INDEX on column with invalid NOT N
@ 2026-08-12 17:17 Álvaro Herrera <alvherre@kurilemu.de>
  0 siblings, 0 replies; 3+ messages in thread

From: Álvaro Herrera @ 2026-08-12 17:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@tigerdata.com>
Reviewed-by: Aleksander Alekseev <aleksander@tigerdata.com>
Reviewed-by: solai v <solai.cdac@gmail.com>
Backpatch-through: 18
Discussion: https://postgr.es/m/CABXQ4dJUibZzN91qvWmsfA7MUDn9YRCNyu3CcukdyokbH1=41Q@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/bdaad789c843f57b1fc66c5ede7abaff8a915c3b

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(+)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Reject REPLICA IDENTITY USING INDEX on column with invalid NOT N
@ 2026-08-12 17:17 Álvaro Herrera <alvherre@kurilemu.de>
  0 siblings, 0 replies; 3+ messages in thread

From: Álvaro Herrera @ 2026-08-12 17:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@tigerdata.com>
Reviewed-by: Aleksander Alekseev <aleksander@tigerdata.com>
Reviewed-by: solai v <solai.cdac@gmail.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(+)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Reject REPLICA IDENTITY USING INDEX on column with invalid NOT N
@ 2026-08-12 17:17 Álvaro Herrera <alvherre@kurilemu.de>
  0 siblings, 0 replies; 3+ messages in thread

From: Álvaro Herrera @ 2026-08-12 17:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@tigerdata.com>
Reviewed-by: Aleksander Alekseev <aleksander@tigerdata.com>
Reviewed-by: solai v <solai.cdac@gmail.com>
Backpatch-through: 18
Discussion: https://postgr.es/m/CABXQ4dJUibZzN91qvWmsfA7MUDn9YRCNyu3CcukdyokbH1=41Q@mail.gmail.com

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/864ef0fb1c91e83dff143d6de3f6f85390b6415b

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(+)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2026-08-12 17:17 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-08-12 17:17 pgsql: Reject REPLICA IDENTITY USING INDEX on column with invalid NOT N Álvaro Herrera <alvherre@kurilemu.de>
2026-08-12 17:17 pgsql: Reject REPLICA IDENTITY USING INDEX on column with invalid NOT N Álvaro Herrera <alvherre@kurilemu.de>
2026-08-12 17:17 pgsql: Reject REPLICA IDENTITY USING INDEX on column with invalid NOT N Álvaro Herrera <alvherre@kurilemu.de>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox