aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2014-12-26 14:31:37 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2014-12-26 14:31:37 -0300
commit6630420fc9139c3a1ee051bc2f2ae8fa32e71c62 (patch)
treec55861e0e3bc13810d21e4d5c0c06fab22a2c52c /src
parent289121a452e3c255e4fd63dbb0252261605c2eaf (diff)
downloadpostgresql-6630420fc9139c3a1ee051bc2f2ae8fa32e71c62.tar.gz
postgresql-6630420fc9139c3a1ee051bc2f2ae8fa32e71c62.zip
Restrict name list len for domain constraints
This avoids an ugly-looking "cache lookup failure" message. Ugliness pointed out by Andres Freund.
Diffstat (limited to 'src')
-rw-r--r--src/backend/catalog/objectaddress.c6
-rw-r--r--src/test/regress/expected/object_address.out4
2 files changed, 8 insertions, 2 deletions
diff --git a/src/backend/catalog/objectaddress.c b/src/backend/catalog/objectaddress.c
index 1f80176cdd8..85079d620ee 100644
--- a/src/backend/catalog/objectaddress.c
+++ b/src/backend/catalog/objectaddress.c
@@ -1534,6 +1534,12 @@ pg_get_object_address(PG_FUNCTION_ARGS)
*/
switch (type)
{
+ case OBJECT_DOMCONSTRAINT:
+ if (list_length(name) < 2)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("name list length must be at least %d", 2)));
+ break;
case OBJECT_LARGEOBJECT:
if (list_length(name) != 1)
ereport(ERROR,
diff --git a/src/test/regress/expected/object_address.out b/src/test/regress/expected/object_address.out
index b760d357eb3..ca9a6d6223e 100644
--- a/src/test/regress/expected/object_address.out
+++ b/src/test/regress/expected/object_address.out
@@ -171,8 +171,8 @@ WARNING: error for table constraint,{addr_nsp,zwei},{}: relation "addr_nsp" doe
WARNING: error for table constraint,{addr_nsp,zwei},{integer}: relation "addr_nsp" does not exist
WARNING: error for table constraint,{eins,zwei,drei},{}: schema "eins" does not exist
WARNING: error for table constraint,{eins,zwei,drei},{integer}: schema "eins" does not exist
-WARNING: error for domain constraint,{eins},{}: cache lookup failed for type 0
-WARNING: error for domain constraint,{eins},{integer}: cache lookup failed for type 0
+WARNING: error for domain constraint,{eins},{}: name list length must be at least 2
+WARNING: error for domain constraint,{eins},{integer}: name list length must be at least 2
WARNING: error for domain constraint,{addr_nsp,zwei},{}: type "addr_nsp" does not exist
WARNING: error for domain constraint,{addr_nsp,zwei},{integer}: type "addr_nsp" does not exist
WARNING: error for domain constraint,{eins,zwei,drei},{}: schema "eins" does not exist