pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Álvaro Herrera <alvherre@kurilemu.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Prevent setting a column as identity if its not-null constraint
Date: Mon, 03 Nov 2025 14:59:08 +0000
Message-ID: <E1vFw1U-004qdf-0F@gemulon.postgresql.org> (raw)

Prevent setting a column as identity if its not-null constraint is invalid

We don't allow null values to appear in identity-generated columns in
other ways, so we shouldn't let unvalidated not-null constraints do it
either.  Oversight in commit a379061a22a8.

Author: jian he <jian.universality@gmail.com>
Backpatch-through: 18
Discussion: https://postgr.es/m/CACJufxGQM_+vZoYJMaRoZfNyV=L2jxosjv_0TLAScbuLJXWRfQ@mail.gmail.com

Branch
------
REL_18_STABLE

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

Modified Files
--------------
src/backend/commands/tablecmds.c          | 25 +++++++++++++++++++++++++
src/test/regress/expected/constraints.out |  4 ++++
src/test/regress/sql/constraints.sql      |  3 +++
3 files changed, 32 insertions(+)



view thread (2+ messages)

Message-ID: <E1vFw1U-004qdf-0F@gemulon.postgresql.org>
Permalink:  ../E1vFw1U-004qdf-0F@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vFw1U-004qdf-0F@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@kurilemu.de, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Prevent setting a column as identity if its not-null constraint
  In-Reply-To: <E1vFw1U-004qdf-0F@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