pgsql: Add ALTER TABLE ... ALTER CONSTRAINT ... SET [NO] INHERIT

From: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add ALTER TABLE ... ALTER CONSTRAINT ... SET [NO] INHERIT
Date: 2025-03-05 12:51:42
Message-ID: E1tpoDu-000uGM-1M@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add ALTER TABLE ... ALTER CONSTRAINT ... SET [NO] INHERIT

This allows to redefine an existing non-inheritable constraint to be
inheritable, which allows to straighten up situations with NO INHERIT
constraints so that thay can become normal constraints without having to
re-verify existing data. For existing inheritance children this may
require creating additional constraints, if they don't exist already.

It also allows to do the opposite, if only for symmetry.

Author: Suraj Kharage <suraj(dot)kharage(at)enterprisedb(dot)com>
Reviewed-by: jian he <jian(dot)universality(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAF1DzPVfOW6Kk=7SSh7LbneQDJWh=PbJrEC_Wkzc24tHOyQWGg@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/ref/alter_table.sgml | 23 +++++-
src/backend/commands/tablecmds.c | 115 +++++++++++++++++++++++++----
src/backend/parser/gram.y | 28 ++++++++
src/include/nodes/parsenodes.h | 2 +
src/test/regress/expected/inherit.out | 131 +++++++++++++++++++++++++++++++++-
src/test/regress/sql/inherit.sql | 79 +++++++++++++++++++-
6 files changed, 359 insertions(+), 19 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2025-03-05 14:30:16 pgsql: Rename some signal and interrupt handling functions for consiste
Previous Message Michael Paquier 2025-03-05 01:17:59 pgsql: Fix some gaps in pg_stat_io with WAL receiver and WAL summarizer