Skip to content

Commit d665162

Browse files
committed
Don't try to use a constraint name as domain name
The bug that caused this to be discovered is that the code was trying to dereference a NULL or ill-defined pointer, as reported by Michael Mueller; but what it was doing was wrong anyway, per Heikki. This patch is Heikki's suggested fix.
1 parent 9f08452 commit d665162

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/commands/typecmds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,13 +2096,13 @@ AlterDomainValidateConstraint(List *names, char *constrName)
20962096
ereport(ERROR,
20972097
(errcode(ERRCODE_UNDEFINED_OBJECT),
20982098
errmsg("constraint \"%s\" of domain \"%s\" does not exist",
2099-
constrName, NameStr(con->conname))));
2099+
constrName, TypeNameToString(typename))));
21002100

21012101
if (con->contype != CONSTRAINT_CHECK)
21022102
ereport(ERROR,
21032103
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
21042104
errmsg("constraint \"%s\" of domain \"%s\" is not a check constraint",
2105-
constrName, NameStr(con->conname))));
2105+
constrName, TypeNameToString(typename))));
21062106

21072107
val = SysCacheGetAttr(CONSTROID, tuple,
21082108
Anum_pg_constraint_conbin,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy