Block ALTER TABLE .. DROP NOT NULL on columns in replica identity index Replica identities that depend directly on an index rely on a set of properties, one of them being that all the columns defined in this index have to be marked as NOT NULL. There was a hole in the logic with ALTER TABLE DROP NOT NULL, where it was possible to remove the NOT NULL property of a column part of an index used as replica identity, so block it to avoid problems with logical decoding down the road.
The same check was already done columns part of a primary key, so the fix is straight-forward. Author: Haiying Tang, Hou Zhijie Reviewed-by: Dilip Kumar, Michael Paquier Discussion: https://postgr.es/m/os0pr01mb6113338c102bee8b2ffc5bd9fb...@os0pr01mb6113.jpnprd01.prod.outlook.com Backpatch-through: 10 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/e415916e24ccf28a88d87182e716beace9820753 Modified Files -------------- src/backend/commands/tablecmds.c | 31 ++++++++++++++++++-------- src/test/regress/expected/replica_identity.out | 4 ++++ src/test/regress/sql/replica_identity.sql | 4 ++++ 3 files changed, 30 insertions(+), 9 deletions(-)
