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

Commit7407b2d

Browse files
committed
Remove dead code
As of commit9895b35, AlterDomainAddConstraint() can only becalled with constraints of type CONSTR_CHECK and CONSTR_NOTNULL. Soall the code to check for and reject other constraint type values isdead and can be removed.Author: jian he <jian.universality@gmail.com>Discussion:https://www.postgresql.org/message-id/flat/CACJufxHitd5LGLBSSAPShhtDWxT0ViVKTHinkYW-skBX93TcpA@mail.gmail.com
1 parent7a947ed commit7407b2d

File tree

1 file changed

+2
-52
lines changed

1 file changed

+2
-52
lines changed

‎src/backend/commands/typecmds.c

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2953,58 +2953,8 @@ AlterDomainAddConstraint(List *names, Node *newConstraint,
29532953

29542954
constr= (Constraint*)newConstraint;
29552955

2956-
switch (constr->contype)
2957-
{
2958-
caseCONSTR_CHECK:
2959-
caseCONSTR_NOTNULL:
2960-
/* processed below */
2961-
break;
2962-
2963-
caseCONSTR_UNIQUE:
2964-
ereport(ERROR,
2965-
(errcode(ERRCODE_SYNTAX_ERROR),
2966-
errmsg("unique constraints not possible for domains")));
2967-
break;
2968-
2969-
caseCONSTR_PRIMARY:
2970-
ereport(ERROR,
2971-
(errcode(ERRCODE_SYNTAX_ERROR),
2972-
errmsg("primary key constraints not possible for domains")));
2973-
break;
2974-
2975-
caseCONSTR_EXCLUSION:
2976-
ereport(ERROR,
2977-
(errcode(ERRCODE_SYNTAX_ERROR),
2978-
errmsg("exclusion constraints not possible for domains")));
2979-
break;
2980-
2981-
caseCONSTR_FOREIGN:
2982-
ereport(ERROR,
2983-
(errcode(ERRCODE_SYNTAX_ERROR),
2984-
errmsg("foreign key constraints not possible for domains")));
2985-
break;
2986-
2987-
caseCONSTR_ATTR_DEFERRABLE:
2988-
caseCONSTR_ATTR_NOT_DEFERRABLE:
2989-
caseCONSTR_ATTR_DEFERRED:
2990-
caseCONSTR_ATTR_IMMEDIATE:
2991-
ereport(ERROR,
2992-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2993-
errmsg("specifying constraint deferrability not supported for domains")));
2994-
break;
2995-
2996-
caseCONSTR_ATTR_ENFORCED:
2997-
caseCONSTR_ATTR_NOT_ENFORCED:
2998-
ereport(ERROR,
2999-
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
3000-
errmsg("specifying constraint enforceability not supported for domains")));
3001-
break;
3002-
3003-
default:
3004-
elog(ERROR,"unrecognized constraint subtype: %d",
3005-
(int)constr->contype);
3006-
break;
3007-
}
2956+
/* enforced by parser */
2957+
Assert(constr->contype==CONSTR_CHECK||constr->contype==CONSTR_NOTNULL);
30082958

30092959
if (constr->contype==CONSTR_CHECK)
30102960
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp