From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Block ALTER TABLE .. DROP NOT NULL on columns in replica identit
Date: Thu, 25 Nov 2021 06:06:36 +0000
Message-ID: <E1mq7u0-0003u9-K7@gemulon.postgresql.org> (raw)
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/OS0PR01MB6113338C102BEE8B2FFC5BD9FB619@OS0PR01MB6113.jpnprd01.prod.outlook.com
Backpatch-through: 10
Branch
------
REL_10_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/817c469c2a167518a7cb44a84c996c7d11a728e4
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(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz
Subject: Re: pgsql: Block ALTER TABLE .. DROP NOT NULL on columns in replica identit
In-Reply-To: <E1mq7u0-0003u9-K7@gemulon.postgresql.org>
References: <E1mq7u0-0003u9-K7@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox