Skip to content

Commit 6630420

Browse files
committed
Restrict name list len for domain constraints
This avoids an ugly-looking "cache lookup failure" message. Ugliness pointed out by Andres Freund.
1 parent 289121a commit 6630420

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/backend/catalog/objectaddress.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,6 +1534,12 @@ pg_get_object_address(PG_FUNCTION_ARGS)
15341534
*/
15351535
switch (type)
15361536
{
1537+
case OBJECT_DOMCONSTRAINT:
1538+
if (list_length(name) < 2)
1539+
ereport(ERROR,
1540+
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1541+
errmsg("name list length must be at least %d", 2)));
1542+
break;
15371543
case OBJECT_LARGEOBJECT:
15381544
if (list_length(name) != 1)
15391545
ereport(ERROR,

src/test/regress/expected/object_address.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ WARNING: error for table constraint,{addr_nsp,zwei},{}: relation "addr_nsp" doe
171171
WARNING: error for table constraint,{addr_nsp,zwei},{integer}: relation "addr_nsp" does not exist
172172
WARNING: error for table constraint,{eins,zwei,drei},{}: schema "eins" does not exist
173173
WARNING: error for table constraint,{eins,zwei,drei},{integer}: schema "eins" does not exist
174-
WARNING: error for domain constraint,{eins},{}: cache lookup failed for type 0
175-
WARNING: error for domain constraint,{eins},{integer}: cache lookup failed for type 0
174+
WARNING: error for domain constraint,{eins},{}: name list length must be at least 2
175+
WARNING: error for domain constraint,{eins},{integer}: name list length must be at least 2
176176
WARNING: error for domain constraint,{addr_nsp,zwei},{}: type "addr_nsp" does not exist
177177
WARNING: error for domain constraint,{addr_nsp,zwei},{integer}: type "addr_nsp" does not exist
178178
WARNING: error for domain constraint,{eins,zwei,drei},{}: schema "eins" does not exist

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