pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix handling of CREATE DOMAIN with GENERATED constraint syntax
Date: Tue, 03 Dec 2024 13:36:26 +0000
Message-ID: <E1tIT4j-000uix-HC@gemulon.postgresql.org> (raw)

Fix handling of CREATE DOMAIN with GENERATED constraint syntax

Stuff like

    CREATE DOMAIN foo AS int CONSTRAINT cc GENERATED ALWAYS AS (2) STORED

is not supported for domains, but the parser allows it, because it's
the same syntax as for table constraints.  But CreateDomain() did not
explicitly handle all ConstrType values, so the above would get an
internal error like

    ERROR:  unrecognized constraint subtype: 4

Fix that by providing a user-facing error message for all ConstrType
values.  Also, remove the switch default case, so future additions to
ConstrType are caught.

Reported-by: Jian He <jian.universality@gmail.com>
Discussion: https://www.postgresql.org/message-id/CACJufxF8fmM=Dbm4pDFuV_nKGz2-No0k4YifhrF3-rjXTWJM3w@mail.gmail...

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/84a67725cd11ffbd5c0e142b067ae90dc3e57270

Modified Files
--------------
src/backend/commands/typecmds.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)



Message-ID: <E1tIT4j-000uix-HC@gemulon.postgresql.org>
Permalink:  ../E1tIT4j-000uix-HC@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1tIT4j-000uix-HC@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: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix handling of CREATE DOMAIN with GENERATED constraint syntax
  In-Reply-To: <E1tIT4j-000uix-HC@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