pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Disallow changing NO INHERIT status of a not-null constraint
Date: Tue, 29 Aug 2023 17:22:58 +0000
Message-ID: <E1qb2Qc-001Ybm-Bn@gemulon.postgresql.org> (raw)

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.ntt@gmail.com>
Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.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(-)



Message-ID: <E1qb2Qc-001Ybm-Bn@gemulon.postgresql.org>
Permalink:  ../E1qb2Qc-001Ybm-Bn@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qb2Qc-001Ybm-Bn@gemulon.postgresql.org

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Disallow changing NO INHERIT status of a not-null constraint
  In-Reply-To: <E1qb2Qc-001Ybm-Bn@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