pgsql: Disallow changing NO INHERIT status of a not-null constraint

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Disallow changing NO INHERIT status of a not-null constraint
Date: 2023-08-29 17:22:58
Message-ID: E1qb2Qc-001Ybm-Bn@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Disallow changing NO INHERIT status of a not-null constraint

It makes no sense to add a NO INHERIT not-null constraint to a child
table that already has one in that column inherited from its parent.
Disallow that, and add tests for the relevant cases.

Per complaint from Kyotaro Horiguchi. I also used part of his proposed
patch.

Co-authored-by: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Co-authored-by: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Discussion: https://postgr.es/m/20230828.161658.1184657435220765047.horikyota.ntt@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9b581c53418666205938311ef86047aa3c6b741f

Modified Files
--------------
src/backend/catalog/heap.c | 13 ++++++++++++-
src/backend/catalog/pg_constraint.c | 22 ++++++++++++++++++----
src/include/catalog/pg_constraint.h | 3 ++-
src/test/regress/expected/inherit.out | 9 +++++++++
src/test/regress/sql/inherit.sql | 6 ++++++
5 files changed, 47 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message noreply 2023-08-29 21:16:47 pgsql: Tag refs/tags/REL_16_RC1 was created
Previous Message Alvaro Herrera 2023-08-29 16:27:54 pgsql: Perl: Remove useless lines