Hackers,

At the moment schemas used as single-level namespaces.
It's quite convenient in large databases.

But error messages doesn’t contain schema names.

I have done a little patch with schema-qualified relation names in error
messages that produced by foreign key constraints and triggers.

Patch and usage example are attached.
Based on real bug hunting.

Pre-reviewed by Alexander Korotkov.
diff --git a/src/backend/utils/adt/ri_triggers.c 
b/src/backend/utils/adt/ri_triggers.c
index b476500..997e959 100644
--- a/src/backend/utils/adt/ri_triggers.c
+++ b/src/backend/utils/adt/ri_triggers.c
@@ -343,7 +343,7 @@ RI_FKey_check(TriggerData *trigdata)
                                        ereport(ERROR,
                                                        
(errcode(ERRCODE_FOREIGN_KEY_VIOLATION),
                                                         errmsg("insert or 
update on table \"%s\" violates foreign key constraint \"%s\"",
-                                                                       
RelationGetRelationName(fk_rel),
+                                                                       
RelationGetNamespaceQualifiedRelationName(fk_rel),
                                                                        
NameStr(riinfo->conname)),
                                                         errdetail("MATCH FULL 
does not allow mixing of null and nonnull key values."),
                                                         
errtableconstraint(fk_rel,
@@ -2490,7 +2490,7 @@ RI_Initial_Check(Trigger *trigger, Relation fk_rel, 
Relation pk_rel)
                        ereport(ERROR,
                                        (errcode(ERRCODE_FOREIGN_KEY_VIOLATION),
                                         errmsg("insert or update on table 
\"%s\" violates foreign key constraint \"%s\"",
-                                                       
RelationGetRelationName(fk_rel),
+                                                       
RelationGetNamespaceQualifiedRelationName(fk_rel),
                                                        
NameStr(fake_riinfo.conname)),
                                         errdetail("MATCH FULL does not allow 
mixing of null and nonnull key values."),
                                         errtableconstraint(fk_rel,
@@ -2767,7 +2767,7 @@ ri_FetchConstraintInfo(Trigger *trigger, Relation 
trig_rel, bool rel_is_pk)
                ereport(ERROR,
                                (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
                  errmsg("no pg_constraint entry for trigger \"%s\" on table 
\"%s\"",
-                                trigger->tgname, 
RelationGetRelationName(trig_rel)),
+                                trigger->tgname, 
RelationGetNamespaceQualifiedRelationName(trig_rel)),
                                 errhint("Remove this referential integrity 
trigger and its mates, then do ALTER TABLE ADD CONSTRAINT.")));
 
        /* Find or create a hashtable entry for the constraint */
@@ -2779,14 +2779,14 @@ ri_FetchConstraintInfo(Trigger *trigger, Relation 
trig_rel, bool rel_is_pk)
                if (riinfo->fk_relid != trigger->tgconstrrelid ||
                        riinfo->pk_relid != RelationGetRelid(trig_rel))
                        elog(ERROR, "wrong pg_constraint entry for trigger 
\"%s\" on table \"%s\"",
-                                trigger->tgname, 
RelationGetRelationName(trig_rel));
+                                trigger->tgname, 
RelationGetNamespaceQualifiedRelationName(trig_rel));
        }
        else
        {
                if (riinfo->fk_relid != RelationGetRelid(trig_rel) ||
                        riinfo->pk_relid != trigger->tgconstrrelid)
                        elog(ERROR, "wrong pg_constraint entry for trigger 
\"%s\" on table \"%s\"",
-                                trigger->tgname, 
RelationGetRelationName(trig_rel));
+                                trigger->tgname, 
RelationGetNamespaceQualifiedRelationName(trig_rel));
        }
 
        return riinfo;
@@ -3225,9 +3225,9 @@ ri_ReportViolation(const RI_ConstraintInfo *riinfo,
                ereport(ERROR,
                                (errcode(ERRCODE_INTERNAL_ERROR),
                                 errmsg("referential integrity query on \"%s\" 
from constraint \"%s\" on \"%s\" gave unexpected result",
-                                               RelationGetRelationName(pk_rel),
+                                               
RelationGetNamespaceQualifiedRelationName(pk_rel),
                                                NameStr(riinfo->conname),
-                                               
RelationGetRelationName(fk_rel)),
+                                               
RelationGetNamespaceQualifiedRelationName(fk_rel)),
                                 errhint("This is most likely due to a rule 
having rewritten the query.")));
 
        /*
@@ -3315,28 +3315,28 @@ ri_ReportViolation(const RI_ConstraintInfo *riinfo,
                ereport(ERROR,
                                (errcode(ERRCODE_FOREIGN_KEY_VIOLATION),
                                 errmsg("insert or update on table \"%s\" 
violates foreign key constraint \"%s\"",
-                                               RelationGetRelationName(fk_rel),
+                                               
RelationGetNamespaceQualifiedRelationName(fk_rel),
                                                NameStr(riinfo->conname)),
                                 has_perm ?
                                 errdetail("Key (%s)=(%s) is not present in 
table \"%s\".",
                                                   key_names.data, 
key_values.data,
-                                                  
RelationGetRelationName(pk_rel)) :
+                                                  
RelationGetNamespaceQualifiedRelationName(pk_rel)) :
                                 errdetail("Key is not present in table 
\"%s\".",
-                                                  
RelationGetRelationName(pk_rel)),
+                                                
RelationGetNamespaceQualifiedRelationName(pk_rel)),
                                 errtableconstraint(fk_rel, 
NameStr(riinfo->conname))));
        else
                ereport(ERROR,
                                (errcode(ERRCODE_FOREIGN_KEY_VIOLATION),
                                 errmsg("update or delete on table \"%s\" 
violates foreign key constraint \"%s\" on table \"%s\"",
-                                               RelationGetRelationName(pk_rel),
+                                               
RelationGetNamespaceQualifiedRelationName(pk_rel),
                                                NameStr(riinfo->conname),
-                                               
RelationGetRelationName(fk_rel)),
+                                               
RelationGetNamespaceQualifiedRelationName(fk_rel)),
                                 has_perm ?
                        errdetail("Key (%s)=(%s) is still referenced from table 
\"%s\".",
                                          key_names.data, key_values.data,
-                                         RelationGetRelationName(fk_rel)) :
+                                         
RelationGetNamespaceQualifiedRelationName(fk_rel)) :
                                 errdetail("Key is still referenced from table 
\"%s\".",
-                                                  
RelationGetRelationName(fk_rel)),
+                                                
RelationGetNamespaceQualifiedRelationName(fk_rel)),
                                 errtableconstraint(fk_rel, 
NameStr(riinfo->conname))));
 }
 
diff --git a/src/backend/utils/cache/relcache.c 
b/src/backend/utils/cache/relcache.c
index fc5b9d9..a7148dc 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -1809,6 +1809,22 @@ RelationDecrementReferenceCount(Relation rel)
 }
 
 /*
+ * RelationGetNamespaceQualifiedRelationName
+ *             Returns fully qualified relname including schema.
+ */
+const char *
+RelationGetNamespaceQualifiedRelationName(Relation rel)
+{
+       StringInfo name = makeStringInfo();
+
+       appendStringInfoString(name, 
get_namespace_name_or_temp(RelationGetNamespace(rel)));
+       appendStringInfoString(name, ".");
+       appendStringInfoString(name, RelationGetRelationName(rel));
+
+       return name->data;
+}
+
+/*
  * RelationClose - close an open relation
  *
  *     Actually, we just decrement the refcount.
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index ff5672d..d45dd8e 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -509,5 +509,6 @@ typedef struct ViewOptions
 /* routines in utils/cache/relcache.c */
 extern void RelationIncrementReferenceCount(Relation rel);
 extern void RelationDecrementReferenceCount(Relation rel);
+const char *RelationGetNamespaceQualifiedRelationName(Relation rel);
 
 #endif   /* REL_H */
diff --git a/src/test/regress/expected/alter_table.out 
b/src/test/regress/expected/alter_table.out
index 7c88ddc..da66974 100644
--- a/src/test/regress/expected/alter_table.out
+++ b/src/test/regress/expected/alter_table.out
@@ -315,8 +315,8 @@ ALTER TABLE tmp3 add constraint tmpconstr foreign key(a) 
references tmp2(b) matc
 ERROR:  column "b" referenced in foreign key constraint does not exist
 -- Try (and fail) to add constraint due to invalid data
 ALTER TABLE tmp3 add constraint tmpconstr foreign key (a) references tmp2 
match full;
-ERROR:  insert or update on table "tmp3" violates foreign key constraint 
"tmpconstr"
-DETAIL:  Key (a)=(5) is not present in table "tmp2".
+ERROR:  insert or update on table "public.tmp3" violates foreign key 
constraint "tmpconstr"
+DETAIL:  Key (a)=(5) is not present in table "public.tmp2".
 -- Delete failing row
 DELETE FROM tmp3 where a=5;
 -- Try (and succeed)
@@ -326,8 +326,8 @@ INSERT INTO tmp3 values (5,50);
 -- Try NOT VALID and then VALIDATE CONSTRAINT, but fails. Delete failure then 
re-validate
 ALTER TABLE tmp3 add constraint tmpconstr foreign key (a) references tmp2 
match full NOT VALID;
 ALTER TABLE tmp3 validate constraint tmpconstr;
-ERROR:  insert or update on table "tmp3" violates foreign key constraint 
"tmpconstr"
-DETAIL:  Key (a)=(5) is not present in table "tmp2".
+ERROR:  insert or update on table "public.tmp3" violates foreign key 
constraint "tmpconstr"
+DETAIL:  Key (a)=(5) is not present in table "public.tmp2".
 -- Delete failing row
 DELETE FROM tmp3 where a=5;
 -- Try (and succeed) and repeat to show it works on already valid constraint
@@ -483,8 +483,8 @@ ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references 
pktable;
 -- Check it actually works
 INSERT INTO FKTABLE VALUES(42);                -- should succeed
 INSERT INTO FKTABLE VALUES(43);                -- should fail
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_ftest1_fkey"
-DETAIL:  Key (ftest1)=(43) is not present in table "pktable".
+ERROR:  insert or update on table "pg_temp.fktable" violates foreign key 
constraint "fktable_ftest1_fkey"
+DETAIL:  Key (ftest1)=(43) is not present in table "pg_temp.pktable".
 DROP TABLE FKTABLE;
 -- This should fail, because we'd have to cast numeric to int which is
 -- not an implicit coercion (or use numeric=numeric, but that's not part
@@ -504,8 +504,8 @@ ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references 
pktable;
 -- Check it actually works
 INSERT INTO FKTABLE VALUES(42);                -- should succeed
 INSERT INTO FKTABLE VALUES(43);                -- should fail
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_ftest1_fkey"
-DETAIL:  Key (ftest1)=(43) is not present in table "pktable".
+ERROR:  insert or update on table "pg_temp.fktable" violates foreign key 
constraint "fktable_ftest1_fkey"
+DETAIL:  Key (ftest1)=(43) is not present in table "pg_temp.pktable".
 DROP TABLE FKTABLE;
 DROP TABLE PKTABLE;
 CREATE TEMP TABLE PKTABLE (ptest1 int, ptest2 inet,
diff --git a/src/test/regress/expected/cluster.out 
b/src/test/regress/expected/cluster.out
index bc26846..aa9b2ef 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -243,8 +243,8 @@ SELECT a,b,c,substring(d for 30), length(d) from clstr_tst;
 
 -- Verify that foreign key link still works
 INSERT INTO clstr_tst (b, c) VALUES (1111, 'this should fail');
-ERROR:  insert or update on table "clstr_tst" violates foreign key constraint 
"clstr_tst_con"
-DETAIL:  Key (b)=(1111) is not present in table "clstr_tst_s".
+ERROR:  insert or update on table "public.clstr_tst" violates foreign key 
constraint "clstr_tst_con"
+DETAIL:  Key (b)=(1111) is not present in table "public.clstr_tst_s".
 SELECT conname FROM pg_constraint WHERE conrelid = 'clstr_tst'::regclass
 ORDER BY 1;
     conname     
diff --git a/src/test/regress/expected/collate.out 
b/src/test/regress/expected/collate.out
index f076a4d..dc1d605 100644
--- a/src/test/regress/expected/collate.out
+++ b/src/test/regress/expected/collate.out
@@ -591,13 +591,13 @@ INSERT INTO collate_test20 VALUES ('foo'), ('bar');
 CREATE TABLE collate_test21 (f2 text COLLATE "POSIX" REFERENCES 
collate_test20);
 INSERT INTO collate_test21 VALUES ('foo'), ('bar');
 INSERT INTO collate_test21 VALUES ('baz'); -- fail
-ERROR:  insert or update on table "collate_test21" violates foreign key 
constraint "collate_test21_f2_fkey"
-DETAIL:  Key (f2)=(baz) is not present in table "collate_test20".
+ERROR:  insert or update on table "collate_tests.collate_test21" violates 
foreign key constraint "collate_test21_f2_fkey"
+DETAIL:  Key (f2)=(baz) is not present in table "collate_tests.collate_test20".
 CREATE TABLE collate_test22 (f2 text COLLATE "POSIX");
 INSERT INTO collate_test22 VALUES ('foo'), ('bar'), ('baz');
 ALTER TABLE collate_test22 ADD FOREIGN KEY (f2) REFERENCES collate_test20; -- 
fail
-ERROR:  insert or update on table "collate_test22" violates foreign key 
constraint "collate_test22_f2_fkey"
-DETAIL:  Key (f2)=(baz) is not present in table "collate_test20".
+ERROR:  insert or update on table "collate_tests.collate_test22" violates 
foreign key constraint "collate_test22_f2_fkey"
+DETAIL:  Key (f2)=(baz) is not present in table "collate_tests.collate_test20".
 DELETE FROM collate_test22 WHERE f2 = 'baz';
 ALTER TABLE collate_test22 ADD FOREIGN KEY (f2) REFERENCES collate_test20;
 RESET enable_seqscan;
diff --git a/src/test/regress/expected/enum.out 
b/src/test/regress/expected/enum.out
index 1a61a5b..69bb3c3 100644
--- a/src/test/regress/expected/enum.out
+++ b/src/test/regress/expected/enum.out
@@ -543,11 +543,11 @@ CREATE TABLE enumtest_child (parent rainbow REFERENCES 
enumtest_parent);
 INSERT INTO enumtest_parent VALUES ('red');
 INSERT INTO enumtest_child VALUES ('red');
 INSERT INTO enumtest_child VALUES ('blue');  -- fail
-ERROR:  insert or update on table "enumtest_child" violates foreign key 
constraint "enumtest_child_parent_fkey"
-DETAIL:  Key (parent)=(blue) is not present in table "enumtest_parent".
+ERROR:  insert or update on table "public.enumtest_child" violates foreign key 
constraint "enumtest_child_parent_fkey"
+DETAIL:  Key (parent)=(blue) is not present in table "public.enumtest_parent".
 DELETE FROM enumtest_parent;  -- fail
-ERROR:  update or delete on table "enumtest_parent" violates foreign key 
constraint "enumtest_child_parent_fkey" on table "enumtest_child"
-DETAIL:  Key (id)=(red) is still referenced from table "enumtest_child".
+ERROR:  update or delete on table "public.enumtest_parent" violates foreign 
key constraint "enumtest_child_parent_fkey" on table "public.enumtest_child"
+DETAIL:  Key (id)=(red) is still referenced from table "public.enumtest_child".
 --
 -- cross-type RI should fail
 --
diff --git a/src/test/regress/expected/foreign_key.out 
b/src/test/regress/expected/foreign_key.out
index 8c47bab..bf4693b 100644
--- a/src/test/regress/expected/foreign_key.out
+++ b/src/test/regress/expected/foreign_key.out
@@ -20,8 +20,8 @@ INSERT INTO FKTABLE VALUES (3, 4);
 INSERT INTO FKTABLE VALUES (NULL, 1);
 -- Insert a failed row into FK TABLE
 INSERT INTO FKTABLE VALUES (100, 2);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_ftest1_fkey"
-DETAIL:  Key (ftest1)=(100) is not present in table "pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "fktable_ftest1_fkey"
+DETAIL:  Key (ftest1)=(100) is not present in table "public.pktable".
 -- Check FKTABLE
 SELECT * FROM FKTABLE;
  ftest1 | ftest2 
@@ -82,16 +82,16 @@ INSERT INTO FKTABLE VALUES (3, 6, 12);
 INSERT INTO FKTABLE VALUES (NULL, NULL, 0);
 -- Insert failed rows into FK TABLE
 INSERT INTO FKTABLE VALUES (100, 2, 4);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"constrname"
-DETAIL:  Key (ftest1, ftest2)=(100, 2) is not present in table "pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "constrname"
+DETAIL:  Key (ftest1, ftest2)=(100, 2) is not present in table 
"public.pktable".
 INSERT INTO FKTABLE VALUES (2, 2, 4);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"constrname"
-DETAIL:  Key (ftest1, ftest2)=(2, 2) is not present in table "pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "constrname"
+DETAIL:  Key (ftest1, ftest2)=(2, 2) is not present in table "public.pktable".
 INSERT INTO FKTABLE VALUES (NULL, 2, 4);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"constrname"
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "constrname"
 DETAIL:  MATCH FULL does not allow mixing of null and nonnull key values.
 INSERT INTO FKTABLE VALUES (1, NULL, 4);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"constrname"
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "constrname"
 DETAIL:  MATCH FULL does not allow mixing of null and nonnull key values.
 -- Check FKTABLE
 SELECT * FROM FKTABLE;
@@ -191,16 +191,16 @@ INSERT INTO FKTABLE VALUES (3, 6, 12);
 INSERT INTO FKTABLE VALUES (NULL, NULL, 0);
 -- Insert failed rows into FK TABLE
 INSERT INTO FKTABLE VALUES (100, 2, 4);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"constrname2"
-DETAIL:  Key (ftest1, ftest2)=(100, 2) is not present in table "pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "constrname2"
+DETAIL:  Key (ftest1, ftest2)=(100, 2) is not present in table 
"public.pktable".
 INSERT INTO FKTABLE VALUES (2, 2, 4);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"constrname2"
-DETAIL:  Key (ftest1, ftest2)=(2, 2) is not present in table "pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "constrname2"
+DETAIL:  Key (ftest1, ftest2)=(2, 2) is not present in table "public.pktable".
 INSERT INTO FKTABLE VALUES (NULL, 2, 4);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"constrname2"
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "constrname2"
 DETAIL:  MATCH FULL does not allow mixing of null and nonnull key values.
 INSERT INTO FKTABLE VALUES (1, NULL, 4);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"constrname2"
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "constrname2"
 DETAIL:  MATCH FULL does not allow mixing of null and nonnull key values.
 -- Check FKTABLE
 SELECT * FROM FKTABLE;
@@ -278,8 +278,8 @@ INSERT INTO FKTABLE VALUES (3, 4);
 INSERT INTO FKTABLE VALUES (NULL, 1);
 -- Insert a failed row into FK TABLE
 INSERT INTO FKTABLE VALUES (100, 2);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_ftest1_fkey"
-DETAIL:  Key (ftest1)=(100) is not present in table "pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "fktable_ftest1_fkey"
+DETAIL:  Key (ftest1)=(100) is not present in table "public.pktable".
 -- Check FKTABLE
 SELECT * FROM FKTABLE;
  ftest1 | ftest2 
@@ -303,8 +303,8 @@ SELECT * FROM PKTABLE;
 
 -- Delete a row from PK TABLE (should fail)
 DELETE FROM PKTABLE WHERE ptest1=1;
-ERROR:  update or delete on table "pktable" violates foreign key constraint 
"fktable_ftest1_fkey" on table "fktable"
-DETAIL:  Key (ptest1)=(1) is still referenced from table "fktable".
+ERROR:  update or delete on table "public.pktable" violates foreign key 
constraint "fktable_ftest1_fkey" on table "public.fktable"
+DETAIL:  Key (ptest1)=(1) is still referenced from table "public.fktable".
 -- Delete a row from PK TABLE (should succeed)
 DELETE FROM PKTABLE WHERE ptest1=5;
 -- Check PKTABLE for deletes
@@ -319,8 +319,8 @@ SELECT * FROM PKTABLE;
 
 -- Update a row from PK TABLE (should fail)
 UPDATE PKTABLE SET ptest1=0 WHERE ptest1=2;
-ERROR:  update or delete on table "pktable" violates foreign key constraint 
"fktable_ftest1_fkey" on table "fktable"
-DETAIL:  Key (ptest1)=(2) is still referenced from table "fktable".
+ERROR:  update or delete on table "public.pktable" violates foreign key 
constraint "fktable_ftest1_fkey" on table "public.fktable"
+DETAIL:  Key (ptest1)=(2) is still referenced from table "public.fktable".
 -- Update a row from PK TABLE (should succeed)
 UPDATE PKTABLE SET ptest1=0 WHERE ptest1=4;
 -- Check PKTABLE for updates
@@ -353,8 +353,8 @@ INSERT INTO FKTABLE VALUES (NULL, 2, 7, 4);
 INSERT INTO FKTABLE VALUES (NULL, 3, 4, 5);
 -- Insert a failed values
 INSERT INTO FKTABLE VALUES (1, 2, 7, 6);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"constrname3"
-DETAIL:  Key (ftest1, ftest2, ftest3)=(1, 2, 7) is not present in table 
"pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "constrname3"
+DETAIL:  Key (ftest1, ftest2, ftest3)=(1, 2, 7) is not present in table 
"public.pktable".
 -- Show FKTABLE
 SELECT * from FKTABLE;
  ftest1 | ftest2 | ftest3 | ftest4 
@@ -368,14 +368,14 @@ SELECT * from FKTABLE;
 
 -- Try to update something that should fail
 UPDATE PKTABLE set ptest2=5 where ptest2=2;
-ERROR:  update or delete on table "pktable" violates foreign key constraint 
"constrname3" on table "fktable"
-DETAIL:  Key (ptest1, ptest2, ptest3)=(1, 2, 3) is still referenced from table 
"fktable".
+ERROR:  update or delete on table "public.pktable" violates foreign key 
constraint "constrname3" on table "public.fktable"
+DETAIL:  Key (ptest1, ptest2, ptest3)=(1, 2, 3) is still referenced from table 
"public.fktable".
 -- Try to update something that should succeed
 UPDATE PKTABLE set ptest1=1 WHERE ptest2=3;
 -- Try to delete something that should fail
 DELETE FROM PKTABLE where ptest1=1 and ptest2=2 and ptest3=3;
-ERROR:  update or delete on table "pktable" violates foreign key constraint 
"constrname3" on table "fktable"
-DETAIL:  Key (ptest1, ptest2, ptest3)=(1, 2, 3) is still referenced from table 
"fktable".
+ERROR:  update or delete on table "public.pktable" violates foreign key 
constraint "constrname3" on table "public.fktable"
+DETAIL:  Key (ptest1, ptest2, ptest3)=(1, 2, 3) is still referenced from table 
"public.fktable".
 -- Try to delete something that should work
 DELETE FROM PKTABLE where ptest1=2;
 -- Show PKTABLE and FKTABLE
@@ -417,8 +417,8 @@ INSERT INTO FKTABLE VALUES (NULL, 2, 7, 4);
 INSERT INTO FKTABLE VALUES (NULL, 3, 4, 5);
 -- Insert a failed values
 INSERT INTO FKTABLE VALUES (1, 2, 7, 6);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"constrname3"
-DETAIL:  Key (ftest1, ftest2, ftest3)=(1, 2, 7) is not present in table 
"pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "constrname3"
+DETAIL:  Key (ftest1, ftest2, ftest3)=(1, 2, 7) is not present in table 
"public.pktable".
 -- Show FKTABLE
 SELECT * from FKTABLE;
  ftest1 | ftest2 | ftest3 | ftest4 
@@ -514,8 +514,8 @@ INSERT INTO FKTABLE VALUES (NULL, 2, 7, 4);
 INSERT INTO FKTABLE VALUES (NULL, 3, 4, 5);
 -- Insert a failed values
 INSERT INTO FKTABLE VALUES (1, 2, 7, 6);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"constrname3"
-DETAIL:  Key (ftest1, ftest2, ftest3)=(1, 2, 7) is not present in table 
"pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "constrname3"
+DETAIL:  Key (ftest1, ftest2, ftest3)=(1, 2, 7) is not present in table 
"public.pktable".
 -- Show FKTABLE
 SELECT * from FKTABLE;
  ftest1 | ftest2 | ftest3 | ftest4 
@@ -619,8 +619,8 @@ INSERT INTO FKTABLE VALUES (NULL, 2, 7, 4);
 INSERT INTO FKTABLE VALUES (NULL, 3, 4, 5);
 -- Insert a failed values
 INSERT INTO FKTABLE VALUES (1, 2, 7, 6);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"constrname3"
-DETAIL:  Key (ftest1, ftest2, ftest3)=(1, 2, 7) is not present in table 
"pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "constrname3"
+DETAIL:  Key (ftest1, ftest2, ftest3)=(1, 2, 7) is not present in table 
"public.pktable".
 -- Show FKTABLE
 SELECT * from FKTABLE;
  ftest1 | ftest2 | ftest3 | ftest4 
@@ -636,8 +636,8 @@ SELECT * from FKTABLE;
 
 -- Try to update something that will fail
 UPDATE PKTABLE set ptest2=5 where ptest2=2;
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"constrname3"
-DETAIL:  Key (ftest1, ftest2, ftest3)=(0, -1, -2) is not present in table 
"pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "constrname3"
+DETAIL:  Key (ftest1, ftest2, ftest3)=(0, -1, -2) is not present in table 
"public.pktable".
 -- Try to update something that will set default
 UPDATE PKTABLE set ptest1=0, ptest2=-1, ptest3=-2 where ptest2=2;
 UPDATE PKTABLE set ptest2=10 where ptest2=4;
@@ -753,12 +753,12 @@ CREATE TABLE FKTABLE (ftest1 int8 REFERENCES pktable);
 -- Check it actually works
 INSERT INTO FKTABLE VALUES(42);                -- should succeed
 INSERT INTO FKTABLE VALUES(43);                -- should fail
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_ftest1_fkey"
-DETAIL:  Key (ftest1)=(43) is not present in table "pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "fktable_ftest1_fkey"
+DETAIL:  Key (ftest1)=(43) is not present in table "public.pktable".
 UPDATE FKTABLE SET ftest1 = ftest1;    -- should succeed
 UPDATE FKTABLE SET ftest1 = ftest1 + 1;        -- should fail
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_ftest1_fkey"
-DETAIL:  Key (ftest1)=(43) is not present in table "pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "fktable_ftest1_fkey"
+DETAIL:  Key (ftest1)=(43) is not present in table "public.pktable".
 DROP TABLE FKTABLE;
 -- This should fail, because we'd have to cast numeric to int which is
 -- not an implicit coercion (or use numeric=numeric, but that's not part
@@ -775,12 +775,12 @@ CREATE TABLE FKTABLE (ftest1 int REFERENCES pktable);
 -- Check it actually works
 INSERT INTO FKTABLE VALUES(42);                -- should succeed
 INSERT INTO FKTABLE VALUES(43);                -- should fail
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_ftest1_fkey"
-DETAIL:  Key (ftest1)=(43) is not present in table "pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "fktable_ftest1_fkey"
+DETAIL:  Key (ftest1)=(43) is not present in table "public.pktable".
 UPDATE FKTABLE SET ftest1 = ftest1;    -- should succeed
 UPDATE FKTABLE SET ftest1 = ftest1 + 1;        -- should fail
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_ftest1_fkey"
-DETAIL:  Key (ftest1)=(43) is not present in table "pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "fktable_ftest1_fkey"
+DETAIL:  Key (ftest1)=(43) is not present in table "public.pktable".
 DROP TABLE FKTABLE;
 DROP TABLE PKTABLE;
 -- Two columns, two tables
@@ -847,20 +847,20 @@ insert into pktable(base1) values (1);
 insert into pktable(base1) values (2);
 --  let's insert a non-existent fktable value
 insert into fktable(ftest1) values (3);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_ftest1_fkey"
-DETAIL:  Key (ftest1)=(3) is not present in table "pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "fktable_ftest1_fkey"
+DETAIL:  Key (ftest1)=(3) is not present in table "public.pktable".
 --  let's make a valid row for that
 insert into pktable(base1) values (3);
 insert into fktable(ftest1) values (3);
 -- let's try removing a row that should fail from pktable
 delete from pktable where base1>2;
-ERROR:  update or delete on table "pktable" violates foreign key constraint 
"fktable_ftest1_fkey" on table "fktable"
-DETAIL:  Key (base1)=(3) is still referenced from table "fktable".
+ERROR:  update or delete on table "public.pktable" violates foreign key 
constraint "fktable_ftest1_fkey" on table "public.fktable"
+DETAIL:  Key (base1)=(3) is still referenced from table "public.fktable".
 -- okay, let's try updating all of the base1 values to *4
 -- which should fail.
 update pktable set base1=base1*4;
-ERROR:  update or delete on table "pktable" violates foreign key constraint 
"fktable_ftest1_fkey" on table "fktable"
-DETAIL:  Key (base1)=(3) is still referenced from table "fktable".
+ERROR:  update or delete on table "public.pktable" violates foreign key 
constraint "fktable_ftest1_fkey" on table "public.fktable"
+DETAIL:  Key (base1)=(3) is still referenced from table "public.fktable".
 -- okay, let's try an update that should work.
 update pktable set base1=base1*4 where base1<3;
 -- and a delete that should work
@@ -875,20 +875,20 @@ insert into pktable(base1, ptest1) values (1, 1);
 insert into pktable(base1, ptest1) values (2, 2);
 --  let's insert a non-existent fktable value
 insert into fktable(ftest1, ftest2) values (3, 1);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_ftest1_fkey"
-DETAIL:  Key (ftest1, ftest2)=(3, 1) is not present in table "pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "fktable_ftest1_fkey"
+DETAIL:  Key (ftest1, ftest2)=(3, 1) is not present in table "public.pktable".
 --  let's make a valid row for that
 insert into pktable(base1,ptest1) values (3, 1);
 insert into fktable(ftest1, ftest2) values (3, 1);
 -- let's try removing a row that should fail from pktable
 delete from pktable where base1>2;
-ERROR:  update or delete on table "pktable" violates foreign key constraint 
"fktable_ftest1_fkey" on table "fktable"
-DETAIL:  Key (base1, ptest1)=(3, 1) is still referenced from table "fktable".
+ERROR:  update or delete on table "public.pktable" violates foreign key 
constraint "fktable_ftest1_fkey" on table "public.fktable"
+DETAIL:  Key (base1, ptest1)=(3, 1) is still referenced from table 
"public.fktable".
 -- okay, let's try updating all of the base1 values to *4
 -- which should fail.
 update pktable set base1=base1*4;
-ERROR:  update or delete on table "pktable" violates foreign key constraint 
"fktable_ftest1_fkey" on table "fktable"
-DETAIL:  Key (base1, ptest1)=(3, 1) is still referenced from table "fktable".
+ERROR:  update or delete on table "public.pktable" violates foreign key 
constraint "fktable_ftest1_fkey" on table "public.fktable"
+DETAIL:  Key (base1, ptest1)=(3, 1) is still referenced from table 
"public.fktable".
 -- okay, let's try an update that should work.
 update pktable set base1=base1*4 where base1<3;
 -- and a delete that should work
@@ -907,16 +907,16 @@ insert into pktable (base1, ptest1, base2, ptest2) values 
(2, 2, 2, 1);
 insert into pktable (base1, ptest1, base2, ptest2) values (1, 3, 2, 2);
 -- fails (3,2) isn't in base1, ptest1
 insert into pktable (base1, ptest1, base2, ptest2) values (2, 3, 3, 2);
-ERROR:  insert or update on table "pktable" violates foreign key constraint 
"pktable_base2_fkey"
-DETAIL:  Key (base2, ptest2)=(3, 2) is not present in table "pktable".
+ERROR:  insert or update on table "public.pktable" violates foreign key 
constraint "pktable_base2_fkey"
+DETAIL:  Key (base2, ptest2)=(3, 2) is not present in table "public.pktable".
 -- fails (2,2) is being referenced
 delete from pktable where base1=2;
-ERROR:  update or delete on table "pktable" violates foreign key constraint 
"pktable_base2_fkey" on table "pktable"
-DETAIL:  Key (base1, ptest1)=(2, 2) is still referenced from table "pktable".
+ERROR:  update or delete on table "public.pktable" violates foreign key 
constraint "pktable_base2_fkey" on table "public.pktable"
+DETAIL:  Key (base1, ptest1)=(2, 2) is still referenced from table 
"public.pktable".
 -- fails (1,1) is being referenced (twice)
 update pktable set base1=3 where base1=1;
-ERROR:  update or delete on table "pktable" violates foreign key constraint 
"pktable_base2_fkey" on table "pktable"
-DETAIL:  Key (base1, ptest1)=(1, 1) is still referenced from table "pktable".
+ERROR:  update or delete on table "public.pktable" violates foreign key 
constraint "pktable_base2_fkey" on table "public.pktable"
+DETAIL:  Key (base1, ptest1)=(1, 1) is still referenced from table 
"public.pktable".
 -- this sequence of two deletes will work, since after the first there will be 
no (2,*) references
 delete from pktable where base2=2;
 delete from pktable where base1=2;
@@ -980,8 +980,8 @@ CREATE TABLE fktable (
 );
 -- default to immediate: should fail
 INSERT INTO fktable VALUES (5, 10);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_fk_fkey"
-DETAIL:  Key (fk)=(10) is not present in table "pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "fktable_fk_fkey"
+DETAIL:  Key (fk)=(10) is not present in table "public.pktable".
 -- explicitly defer the constraint
 BEGIN;
 SET CONSTRAINTS ALL DEFERRED;
@@ -1008,8 +1008,8 @@ BEGIN;
 SET CONSTRAINTS ALL IMMEDIATE;
 -- should fail
 INSERT INTO fktable VALUES (500, 1000);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_fk_fkey"
-DETAIL:  Key (fk)=(1000) is not present in table "pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "fktable_fk_fkey"
+DETAIL:  Key (fk)=(1000) is not present in table "public.pktable".
 COMMIT;
 DROP TABLE fktable, pktable;
 -- tricky behavior: according to SQL99, if a deferred constraint is set
@@ -1030,8 +1030,8 @@ SET CONSTRAINTS ALL DEFERRED;
 INSERT INTO fktable VALUES (1000, 2000);
 -- should cause transaction abort, due to preceding error
 SET CONSTRAINTS ALL IMMEDIATE;
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_fk_fkey"
-DETAIL:  Key (fk)=(2000) is not present in table "pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "fktable_fk_fkey"
+DETAIL:  Key (fk)=(2000) is not present in table "public.pktable".
 INSERT INTO pktable VALUES (2000, 3); -- too late
 ERROR:  current transaction is aborted, commands ignored until end of 
transaction block
 COMMIT;
@@ -1050,8 +1050,8 @@ BEGIN;
 INSERT INTO fktable VALUES (100, 200);
 -- error here on commit
 COMMIT;
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_fk_fkey"
-DETAIL:  Key (fk)=(200) is not present in table "pktable".
+ERROR:  insert or update on table "public.fktable" violates foreign key 
constraint "fktable_fk_fkey"
+DETAIL:  Key (fk)=(200) is not present in table "public.pktable".
 DROP TABLE pktable, fktable;
 -- test notice about expensive referential integrity checks,
 -- where the index cannot be used because of type incompatibilities.
@@ -1140,8 +1140,8 @@ INSERT INTO fktable VALUES (0, 20);
 UPDATE fktable SET id = id + 1;
 -- should catch error from initial INSERT
 COMMIT;
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_fk_fkey"
-DETAIL:  Key (fk)=(20) is not present in table "pktable".
+ERROR:  insert or update on table "pg_temp.fktable" violates foreign key 
constraint "fktable_fk_fkey"
+DETAIL:  Key (fk)=(20) is not present in table "pg_temp.pktable".
 -- check same case when insert is in a different subtransaction than update
 BEGIN;
 -- doesn't match PK, but no error yet
@@ -1152,8 +1152,8 @@ SAVEPOINT savept1;
 UPDATE fktable SET id = id + 1;
 -- should catch error from initial INSERT
 COMMIT;
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_fk_fkey"
-DETAIL:  Key (fk)=(20) is not present in table "pktable".
+ERROR:  insert or update on table "pg_temp.fktable" violates foreign key 
constraint "fktable_fk_fkey"
+DETAIL:  Key (fk)=(20) is not present in table "pg_temp.pktable".
 BEGIN;
 -- INSERT will be in a subxact
 SAVEPOINT savept1;
@@ -1164,8 +1164,8 @@ RELEASE SAVEPOINT savept1;
 UPDATE fktable SET id = id + 1;
 -- should catch error from initial INSERT
 COMMIT;
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_fk_fkey"
-DETAIL:  Key (fk)=(20) is not present in table "pktable".
+ERROR:  insert or update on table "pg_temp.fktable" violates foreign key 
constraint "fktable_fk_fkey"
+DETAIL:  Key (fk)=(20) is not present in table "pg_temp.pktable".
 BEGIN;
 -- doesn't match PK, but no error yet
 INSERT INTO fktable VALUES (0, 20);
@@ -1177,8 +1177,8 @@ UPDATE fktable SET id = id + 1;
 ROLLBACK TO savept1;
 -- should catch error from initial INSERT
 COMMIT;
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_fk_fkey"
-DETAIL:  Key (fk)=(20) is not present in table "pktable".
+ERROR:  insert or update on table "pg_temp.fktable" violates foreign key 
constraint "fktable_fk_fkey"
+DETAIL:  Key (fk)=(20) is not present in table "pg_temp.pktable".
 --
 -- check ALTER CONSTRAINT
 --
@@ -1187,14 +1187,14 @@ ALTER TABLE fktable ALTER CONSTRAINT fktable_fk_fkey 
DEFERRABLE INITIALLY IMMEDI
 BEGIN;
 -- doesn't match FK, should throw error now
 UPDATE pktable SET id = 10 WHERE id = 5;
-ERROR:  update or delete on table "pktable" violates foreign key constraint 
"fktable_fk_fkey" on table "fktable"
-DETAIL:  Key (id)=(5) is still referenced from table "fktable".
+ERROR:  update or delete on table "pg_temp.pktable" violates foreign key 
constraint "fktable_fk_fkey" on table "pg_temp.fktable"
+DETAIL:  Key (id)=(5) is still referenced from table "pg_temp.fktable".
 COMMIT;
 BEGIN;
 -- doesn't match PK, should throw error now
 INSERT INTO fktable VALUES (0, 20);
-ERROR:  insert or update on table "fktable" violates foreign key constraint 
"fktable_fk_fkey"
-DETAIL:  Key (fk)=(20) is not present in table "pktable".
+ERROR:  insert or update on table "pg_temp.fktable" violates foreign key 
constraint "fktable_fk_fkey"
+DETAIL:  Key (fk)=(20) is not present in table "pg_temp.pktable".
 COMMIT;
 -- try additional syntax
 ALTER TABLE fktable ALTER CONSTRAINT fktable_fk_fkey NOT DEFERRABLE;
@@ -1322,8 +1322,8 @@ select * from defc;
 (1 row)
 
 delete from defp where f1 = 0; -- fail
-ERROR:  update or delete on table "defp" violates foreign key constraint 
"defc_f1_fkey" on table "defc"
-DETAIL:  Key (f1)=(0) is still referenced from table "defc".
+ERROR:  update or delete on table "pg_temp.defp" violates foreign key 
constraint "defc_f1_fkey" on table "pg_temp.defc"
+DETAIL:  Key (f1)=(0) is still referenced from table "pg_temp.defc".
 alter table defc alter column f1 set default 1;
 delete from defp where f1 = 0;
 select * from defc;
@@ -1333,8 +1333,8 @@ select * from defc;
 (1 row)
 
 delete from defp where f1 = 1; -- fail
-ERROR:  update or delete on table "defp" violates foreign key constraint 
"defc_f1_fkey" on table "defc"
-DETAIL:  Key (f1)=(1) is still referenced from table "defc".
+ERROR:  update or delete on table "pg_temp.defp" violates foreign key 
constraint "defc_f1_fkey" on table "pg_temp.defc"
+DETAIL:  Key (f1)=(1) is still referenced from table "pg_temp.defc".
 --
 -- Test the difference between NO ACTION and RESTRICT
 --
@@ -1346,8 +1346,8 @@ update pp set f1=f1+1;
 insert into cc values(13);
 update pp set f1=f1+1;
 update pp set f1=f1+1; -- fail
-ERROR:  update or delete on table "pp" violates foreign key constraint 
"cc_f1_fkey" on table "cc"
-DETAIL:  Key (f1)=(13) is still referenced from table "cc".
+ERROR:  update or delete on table "pg_temp.pp" violates foreign key constraint 
"cc_f1_fkey" on table "pg_temp.cc"
+DETAIL:  Key (f1)=(13) is still referenced from table "pg_temp.cc".
 drop table pp, cc;
 create temp table pp (f1 int primary key);
 create temp table cc (f1 int references pp on update restrict);
@@ -1356,6 +1356,6 @@ insert into pp values(11);
 update pp set f1=f1+1;
 insert into cc values(13);
 update pp set f1=f1+1; -- fail
-ERROR:  update or delete on table "pp" violates foreign key constraint 
"cc_f1_fkey" on table "cc"
-DETAIL:  Key (f1)=(13) is still referenced from table "cc".
+ERROR:  update or delete on table "pg_temp.pp" violates foreign key constraint 
"cc_f1_fkey" on table "pg_temp.cc"
+DETAIL:  Key (f1)=(13) is still referenced from table "pg_temp.cc".
 drop table pp, cc;
diff --git a/src/test/regress/expected/plpgsql.out 
b/src/test/regress/expected/plpgsql.out
index e30c579..24a36ef 100644
--- a/src/test/regress/expected/plpgsql.out
+++ b/src/test/regress/expected/plpgsql.out
@@ -2105,8 +2105,8 @@ create temp table slave(f1 int references master 
deferrable);
 insert into master values(1);
 insert into slave values(1);
 insert into slave values(2);   -- fails
-ERROR:  insert or update on table "slave" violates foreign key constraint 
"slave_f1_fkey"
-DETAIL:  Key (f1)=(2) is not present in table "master".
+ERROR:  insert or update on table "pg_temp.slave" violates foreign key 
constraint "slave_f1_fkey"
+DETAIL:  Key (f1)=(2) is not present in table "pg_temp.master".
 create function trap_foreign_key(int) returns int as $$
 begin
        begin   -- start a subtransaction
@@ -2152,8 +2152,8 @@ begin;
 
   savepoint x;
     set constraints all immediate; -- fails
-ERROR:  insert or update on table "slave" violates foreign key constraint 
"slave_f1_fkey"
-DETAIL:  Key (f1)=(2) is not present in table "master".
+ERROR:  insert or update on table "pg_temp.slave" violates foreign key 
constraint "slave_f1_fkey"
+DETAIL:  Key (f1)=(2) is not present in table "pg_temp.master".
   rollback to x;
   select trap_foreign_key_2();  -- detects FK violation
 NOTICE:  caught foreign_key_violation
@@ -2163,8 +2163,8 @@ NOTICE:  caught foreign_key_violation
 (1 row)
 
 commit;                                -- still fails
-ERROR:  insert or update on table "slave" violates foreign key constraint 
"slave_f1_fkey"
-DETAIL:  Key (f1)=(2) is not present in table "master".
+ERROR:  insert or update on table "pg_temp.slave" violates foreign key 
constraint "slave_f1_fkey"
+DETAIL:  Key (f1)=(2) is not present in table "pg_temp.master".
 drop function trap_foreign_key(int);
 drop function trap_foreign_key_2();
 --
diff --git a/src/test/regress/expected/rowsecurity.out 
b/src/test/regress/expected/rowsecurity.out
index 4aaa88f..63c0031 100644
--- a/src/test/regress/expected/rowsecurity.out
+++ b/src/test/regress/expected/rowsecurity.out
@@ -306,8 +306,8 @@ SELECT * FROM document d FULL OUTER JOIN category c on 
d.cid = c.cid;
 (6 rows)
 
 DELETE FROM category WHERE cid = 33;    -- fails with FK violation
-ERROR:  update or delete on table "category" violates foreign key constraint 
"document_cid_fkey" on table "document"
-DETAIL:  Key is still referenced from table "document".
+ERROR:  update or delete on table "rls_regress_schema.category" violates 
foreign key constraint "document_cid_fkey" on table 
"rls_regress_schema.document"
+DETAIL:  Key is still referenced from table "rls_regress_schema.document".
 -- can insert FK referencing invisible PK
 SET SESSION AUTHORIZATION rls_regress_user2;
 SELECT * FROM document d FULL OUTER JOIN category c on d.cid = c.cid;
@@ -3242,8 +3242,8 @@ ALTER TABLE r2 ENABLE ROW LEVEL SECURITY;
 ALTER TABLE r2 FORCE ROW LEVEL SECURITY;
 -- Errors due to rows in r2
 DELETE FROM r1;
-ERROR:  update or delete on table "r1" violates foreign key constraint 
"r2_a_fkey" on table "r2"
-DETAIL:  Key (a)=(10) is still referenced from table "r2".
+ERROR:  update or delete on table "rls_regress_schema.r1" violates foreign key 
constraint "r2_a_fkey" on table "rls_regress_schema.r2"
+DETAIL:  Key (a)=(10) is still referenced from table "rls_regress_schema.r2".
 -- Reset r2 to no-RLS
 DROP POLICY p1 ON r2;
 ALTER TABLE r2 NO FORCE ROW LEVEL SECURITY;
diff --git a/src/test/regress/expected/rules.out 
b/src/test/regress/expected/rules.out
index 80374e4..6b5b23f 100644
--- a/src/test/regress/expected/rules.out
+++ b/src/test/regress/expected/rules.out
@@ -2375,22 +2375,22 @@ insert into rule_and_refint_t3 values (1, 11, 12, 
'row2');
 insert into rule_and_refint_t3 values (1, 12, 11, 'row3');
 insert into rule_and_refint_t3 values (1, 12, 12, 'row4');
 insert into rule_and_refint_t3 values (1, 11, 13, 'row5');
-ERROR:  insert or update on table "rule_and_refint_t3" violates foreign key 
constraint "rule_and_refint_t3_id3a_fkey1"
-DETAIL:  Key (id3a, id3c)=(1, 13) is not present in table "rule_and_refint_t2".
+ERROR:  insert or update on table "public.rule_and_refint_t3" violates foreign 
key constraint "rule_and_refint_t3_id3a_fkey1"
+DETAIL:  Key (id3a, id3c)=(1, 13) is not present in table 
"public.rule_and_refint_t2".
 insert into rule_and_refint_t3 values (1, 13, 11, 'row6');
-ERROR:  insert or update on table "rule_and_refint_t3" violates foreign key 
constraint "rule_and_refint_t3_id3a_fkey"
-DETAIL:  Key (id3a, id3b)=(1, 13) is not present in table "rule_and_refint_t1".
+ERROR:  insert or update on table "public.rule_and_refint_t3" violates foreign 
key constraint "rule_and_refint_t3_id3a_fkey"
+DETAIL:  Key (id3a, id3b)=(1, 13) is not present in table 
"public.rule_and_refint_t1".
 -- Ordinary table
 insert into rule_and_refint_t3 values (1, 13, 11, 'row6')
   on conflict do nothing;
-ERROR:  insert or update on table "rule_and_refint_t3" violates foreign key 
constraint "rule_and_refint_t3_id3a_fkey"
-DETAIL:  Key (id3a, id3b)=(1, 13) is not present in table "rule_and_refint_t1".
+ERROR:  insert or update on table "public.rule_and_refint_t3" violates foreign 
key constraint "rule_and_refint_t3_id3a_fkey"
+DETAIL:  Key (id3a, id3b)=(1, 13) is not present in table 
"public.rule_and_refint_t1".
 -- rule not fired, so fk violation
 insert into rule_and_refint_t3 values (1, 13, 11, 'row6')
   on conflict (id3a, id3b, id3c) do update
   set id3b = excluded.id3b;
-ERROR:  insert or update on table "rule_and_refint_t3" violates foreign key 
constraint "rule_and_refint_t3_id3a_fkey"
-DETAIL:  Key (id3a, id3b)=(1, 13) is not present in table "rule_and_refint_t1".
+ERROR:  insert or update on table "public.rule_and_refint_t3" violates foreign 
key constraint "rule_and_refint_t3_id3a_fkey"
+DETAIL:  Key (id3a, id3b)=(1, 13) is not present in table 
"public.rule_and_refint_t1".
 -- rule fired, so unsupported
 insert into shoelace values ('sl9', 0, 'pink', 35.0, 'inch', 0.0)
   on conflict (sl_name) do update
@@ -2406,11 +2406,11 @@ create rule rule_and_refint_t3_ins as on insert to 
rule_and_refint_t3
        and (rule_and_refint_t3.id3b = new.id3b))
        and (rule_and_refint_t3.id3c = new.id3c));
 insert into rule_and_refint_t3 values (1, 11, 13, 'row7');
-ERROR:  insert or update on table "rule_and_refint_t3" violates foreign key 
constraint "rule_and_refint_t3_id3a_fkey1"
-DETAIL:  Key (id3a, id3c)=(1, 13) is not present in table "rule_and_refint_t2".
+ERROR:  insert or update on table "public.rule_and_refint_t3" violates foreign 
key constraint "rule_and_refint_t3_id3a_fkey1"
+DETAIL:  Key (id3a, id3c)=(1, 13) is not present in table 
"public.rule_and_refint_t2".
 insert into rule_and_refint_t3 values (1, 13, 11, 'row8');
-ERROR:  insert or update on table "rule_and_refint_t3" violates foreign key 
constraint "rule_and_refint_t3_id3a_fkey"
-DETAIL:  Key (id3a, id3b)=(1, 13) is not present in table "rule_and_refint_t1".
+ERROR:  insert or update on table "public.rule_and_refint_t3" violates foreign 
key constraint "rule_and_refint_t3_id3a_fkey"
+DETAIL:  Key (id3a, id3b)=(1, 13) is not present in table 
"public.rule_and_refint_t1".
 --
 -- disallow dropping a view's rule (bug #5072)
 --

Attachment: example.sql
Description: Binary data

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to