mirror of
https://github.com/postgres/postgres.git
synced 2025-09-11 00:12:06 +03:00
Remove dead code
As of commit 9895b35cb8
, AlterDomainAddConstraint() can only be
called with constraints of type CONSTR_CHECK and CONSTR_NOTNULL. So
all the code to check for and reject other constraint type values is
dead and can be removed.
Author: jian he <jian.universality@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CACJufxHitd5LGLBSSAPShhtDWxT0ViVKTHinkYW-skBX93TcpA@mail.gmail.com
This commit is contained in:
@@ -2953,58 +2953,8 @@ AlterDomainAddConstraint(List *names, Node *newConstraint,
|
|||||||
|
|
||||||
constr = (Constraint *) newConstraint;
|
constr = (Constraint *) newConstraint;
|
||||||
|
|
||||||
switch (constr->contype)
|
/* enforced by parser */
|
||||||
{
|
Assert(constr->contype == CONSTR_CHECK || constr->contype == CONSTR_NOTNULL);
|
||||||
case CONSTR_CHECK:
|
|
||||||
case CONSTR_NOTNULL:
|
|
||||||
/* processed below */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CONSTR_UNIQUE:
|
|
||||||
ereport(ERROR,
|
|
||||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
|
||||||
errmsg("unique constraints not possible for domains")));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CONSTR_PRIMARY:
|
|
||||||
ereport(ERROR,
|
|
||||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
|
||||||
errmsg("primary key constraints not possible for domains")));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CONSTR_EXCLUSION:
|
|
||||||
ereport(ERROR,
|
|
||||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
|
||||||
errmsg("exclusion constraints not possible for domains")));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CONSTR_FOREIGN:
|
|
||||||
ereport(ERROR,
|
|
||||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
|
||||||
errmsg("foreign key constraints not possible for domains")));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CONSTR_ATTR_DEFERRABLE:
|
|
||||||
case CONSTR_ATTR_NOT_DEFERRABLE:
|
|
||||||
case CONSTR_ATTR_DEFERRED:
|
|
||||||
case CONSTR_ATTR_IMMEDIATE:
|
|
||||||
ereport(ERROR,
|
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
|
||||||
errmsg("specifying constraint deferrability not supported for domains")));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CONSTR_ATTR_ENFORCED:
|
|
||||||
case CONSTR_ATTR_NOT_ENFORCED:
|
|
||||||
ereport(ERROR,
|
|
||||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
|
||||||
errmsg("specifying constraint enforceability not supported for domains")));
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
elog(ERROR, "unrecognized constraint subtype: %d",
|
|
||||||
(int) constr->contype);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (constr->contype == CONSTR_CHECK)
|
if (constr->contype == CONSTR_CHECK)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user