pgsql: Prevent setting a column as identity if its not-null constraint

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Prevent setting a column as identity if its not-null constraint
Date: 2025-11-03 14:59:08
Message-ID: E1vFw1U-004qdd-0A@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(dot)universality(at)gmail(dot)com>
Backpatch-through: 18
Discussion: https://postgr.es/m/CACJufxGQM_+vZoYJMaRoZfNyV=L2jxosjv_0TLAScbuLJXWRfQ@mail.gmail.com

Branch
------
master

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

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(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Álvaro Herrera 2025-11-03 16:42:00 pgsql: Add \pset options for boolean value display
Previous Message Álvaro Herrera 2025-11-03 12:02:10 pgsql: Remove WaitPMResult enum in pg_createsubscriber