Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit84a6772

Browse files
committed
Fix handling of CREATE DOMAIN with GENERATED constraint syntax
Stuff like CREATE DOMAIN foo AS int CONSTRAINT cc GENERATED ALWAYS AS (2) STOREDis not supported for domains, but the parser allows it, because it'sthe same syntax as for table constraints. But CreateDomain() did notexplicitly handle all ConstrType values, so the above would get aninternal error like ERROR: unrecognized constraint subtype: 4Fix that by providing a user-facing error message for all ConstrTypevalues. Also, remove the switch default case, so future additions toConstrType are caught.Reported-by: Jian He <jian.universality@gmail.com>Discussion:https://www.postgresql.org/message-id/CACJufxF8fmM=Dbm4pDFuV_nKGz2-No0k4YifhrF3-rjXTWJM3w@mail.gmail.com
1 parent1acf105 commit84a6772

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

‎src/backend/commands/typecmds.c‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,10 +1011,14 @@ DefineDomain(CreateDomainStmt *stmt)
10111011
errmsg("specifying constraint deferrability not supported for domains")));
10121012
break;
10131013

1014-
default:
1015-
elog(ERROR,"unrecognized constraint subtype: %d",
1016-
(int)constr->contype);
1014+
caseCONSTR_GENERATED:
1015+
caseCONSTR_IDENTITY:
1016+
ereport(ERROR,
1017+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1018+
errmsg("specifying GENERATED not supported for domains")));
10171019
break;
1020+
1021+
/* no default, to let compiler warn about missing case */
10181022
}
10191023
}
10201024

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp