From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix handling of CREATE DOMAIN with GENERATED constraint syntax |
Date: | 2024-12-03 13:36:26 |
Message-ID: | E1tIT4j-000uix-HC@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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(dot)universality(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/CACJufxF8fmM=Dbm4pDFuV_nKGz2-No0k4YifhrF3-rjXTWJM3w@mail.gmail.com
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(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Álvaro Herrera | 2024-12-03 13:46:53 | pgsql: Update obsolete comment |
Previous Message | Andrei Lepikhov | 2024-12-03 09:15:20 | Re: pgsql: Avoid mislabeling of lateral references when pulling up a subque |