diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index ce6d6794d268b3561be23208890ac5953f3ced91..ecac95c426f6eda159047b3da7a3eecf9368e7ec 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -27,7 +27,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.171 2002/07/20 05:16:57 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.172 2002/08/04 05:04:39 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1582,8 +1582,8 @@ ExecConstraints(const char *caller, ResultRelInfo *resultRelInfo,
 		char	   *failed;
 
 		if ((failed = ExecRelCheck(resultRelInfo, slot, estate)) != NULL)
-			elog(ERROR, "%s: rejected due to CHECK constraint %s",
-				 caller, failed);
+			elog(ERROR, "%s: rejected due to CHECK constraint \"%s\" on \"%s\"",
+				 caller, failed, RelationGetRelationName(rel));
 	}
 }
 
diff --git a/src/test/regress/output/constraints.source b/src/test/regress/output/constraints.source
index 8935dae873468b710d4107d17a5f90a488e879a1..cfc5afa67d544e2a25877574912ab7e5d52c1559 100644
--- a/src/test/regress/output/constraints.source
+++ b/src/test/regress/output/constraints.source
@@ -62,12 +62,12 @@ CREATE TABLE CHECK_TBL (x int,
 INSERT INTO CHECK_TBL VALUES (5);
 INSERT INTO CHECK_TBL VALUES (4);
 INSERT INTO CHECK_TBL VALUES (3);
-ERROR:  ExecInsert: rejected due to CHECK constraint check_con
+ERROR:  ExecInsert: rejected due to CHECK constraint "check_con" on "check_tbl"
 INSERT INTO CHECK_TBL VALUES (2);
-ERROR:  ExecInsert: rejected due to CHECK constraint check_con
+ERROR:  ExecInsert: rejected due to CHECK constraint "check_con" on "check_tbl"
 INSERT INTO CHECK_TBL VALUES (6);
 INSERT INTO CHECK_TBL VALUES (1);
-ERROR:  ExecInsert: rejected due to CHECK constraint check_con
+ERROR:  ExecInsert: rejected due to CHECK constraint "check_con" on "check_tbl"
 SELECT '' AS three, * FROM CHECK_TBL;
  three | x 
 -------+---
@@ -82,13 +82,13 @@ CREATE TABLE CHECK2_TBL (x int, y text, z int,
 	CHECK (x > 3 and y <> 'check failed' and z < 8));
 INSERT INTO CHECK2_TBL VALUES (4, 'check ok', -2);
 INSERT INTO CHECK2_TBL VALUES (1, 'x check failed', -2);
-ERROR:  ExecInsert: rejected due to CHECK constraint sequence_con
+ERROR:  ExecInsert: rejected due to CHECK constraint "sequence_con" on "check2_tbl"
 INSERT INTO CHECK2_TBL VALUES (5, 'z check failed', 10);
-ERROR:  ExecInsert: rejected due to CHECK constraint sequence_con
+ERROR:  ExecInsert: rejected due to CHECK constraint "sequence_con" on "check2_tbl"
 INSERT INTO CHECK2_TBL VALUES (0, 'check failed', -2);
-ERROR:  ExecInsert: rejected due to CHECK constraint sequence_con
+ERROR:  ExecInsert: rejected due to CHECK constraint "sequence_con" on "check2_tbl"
 INSERT INTO CHECK2_TBL VALUES (6, 'check failed', 11);
-ERROR:  ExecInsert: rejected due to CHECK constraint sequence_con
+ERROR:  ExecInsert: rejected due to CHECK constraint "sequence_con" on "check2_tbl"
 INSERT INTO CHECK2_TBL VALUES (7, 'check ok', 7);
 SELECT '' AS two, * from CHECK2_TBL;
  two | x |    y     | z  
@@ -107,7 +107,7 @@ CREATE TABLE INSERT_TBL (x INT DEFAULT nextval('insert_seq'),
 	CONSTRAINT INSERT_CON CHECK (x >= 3 AND y <> 'check failed' AND x < 8),
 	CHECK (x + z = 0));
 INSERT INTO INSERT_TBL(x,z) VALUES (2, -2);
-ERROR:  ExecInsert: rejected due to CHECK constraint insert_con
+ERROR:  ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
 SELECT '' AS zero, * FROM INSERT_TBL;
  zero | x | y | z 
 ------+---+---+---
@@ -120,13 +120,13 @@ SELECT 'one' AS one, nextval('insert_seq');
 (1 row)
 
 INSERT INTO INSERT_TBL(y) VALUES ('Y');
-ERROR:  ExecInsert: rejected due to CHECK constraint insert_con
+ERROR:  ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
 INSERT INTO INSERT_TBL(y) VALUES ('Y');
 INSERT INTO INSERT_TBL(x,z) VALUES (1, -2);
-ERROR:  ExecInsert: rejected due to CHECK constraint $1
+ERROR:  ExecInsert: rejected due to CHECK constraint "$1" on "insert_tbl"
 INSERT INTO INSERT_TBL(z,x) VALUES (-7,  7);
 INSERT INTO INSERT_TBL VALUES (5, 'check failed', -5);
-ERROR:  ExecInsert: rejected due to CHECK constraint insert_con
+ERROR:  ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
 INSERT INTO INSERT_TBL VALUES (7, '!check failed', -7);
 INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-');
 SELECT '' AS four, * FROM INSERT_TBL;
@@ -139,9 +139,9 @@ SELECT '' AS four, * FROM INSERT_TBL;
 (4 rows)
 
 INSERT INTO INSERT_TBL(y,z) VALUES ('check failed', 4);
-ERROR:  ExecInsert: rejected due to CHECK constraint $1
+ERROR:  ExecInsert: rejected due to CHECK constraint "$1" on "insert_tbl"
 INSERT INTO INSERT_TBL(x,y) VALUES (5, 'check failed');
-ERROR:  ExecInsert: rejected due to CHECK constraint insert_con
+ERROR:  ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
 INSERT INTO INSERT_TBL(x,y) VALUES (5, '!check failed');
 INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-');
 SELECT '' AS six, * FROM INSERT_TBL;
@@ -162,7 +162,7 @@ SELECT 'seven' AS one, nextval('insert_seq');
 (1 row)
 
 INSERT INTO INSERT_TBL(y) VALUES ('Y');
-ERROR:  ExecInsert: rejected due to CHECK constraint insert_con
+ERROR:  ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
 SELECT 'eight' AS one, currval('insert_seq');
   one  | currval 
 -------+---------
@@ -193,11 +193,11 @@ CREATE TABLE INSERT_CHILD (cx INT default 42,
 	INHERITS (INSERT_TBL);
 INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,11);
 INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,6);
-ERROR:  ExecInsert: rejected due to CHECK constraint insert_child_cy
+ERROR:  ExecInsert: rejected due to CHECK constraint "insert_child_cy" on "insert_child"
 INSERT INTO INSERT_CHILD(x,z,cy) VALUES (6,-7,7);
-ERROR:  ExecInsert: rejected due to CHECK constraint $1
+ERROR:  ExecInsert: rejected due to CHECK constraint "$1" on "insert_child"
 INSERT INTO INSERT_CHILD(x,y,z,cy) VALUES (6,'check failed',-6,7);
-ERROR:  ExecInsert: rejected due to CHECK constraint insert_con
+ERROR:  ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_child"
 SELECT * FROM INSERT_CHILD;
  x |   y    | z  | cx | cy 
 ---+--------+----+----+----
@@ -227,7 +227,7 @@ SELECT '' AS three, * FROM INSERT_TBL;
 INSERT INTO INSERT_TBL SELECT * FROM tmp WHERE yd = 'try again';
 INSERT INTO INSERT_TBL(y,z) SELECT yd, -7 FROM tmp WHERE yd = 'try again';
 INSERT INTO INSERT_TBL(y,z) SELECT yd, -8 FROM tmp WHERE yd = 'try again';
-ERROR:  ExecInsert: rejected due to CHECK constraint insert_con
+ERROR:  ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
 SELECT '' AS four, * FROM INSERT_TBL;
  four | x |       y       | z  
 ------+---+---------------+----
@@ -246,7 +246,7 @@ UPDATE INSERT_TBL SET x = NULL WHERE x = 5;
 UPDATE INSERT_TBL SET x = 6 WHERE x = 6;
 UPDATE INSERT_TBL SET x = -z, z = -x;
 UPDATE INSERT_TBL SET x = z, z = x;
-ERROR:  ExecUpdate: rejected due to CHECK constraint insert_con
+ERROR:  ExecUpdate: rejected due to CHECK constraint "insert_con" on "insert_tbl"
 SELECT * FROM INSERT_TBL;
  x |       y       | z  
 ---+---------------+----
@@ -273,7 +273,7 @@ SELECT '' AS two, * FROM COPY_TBL;
 (2 rows)
 
 COPY COPY_TBL FROM '@abs_srcdir@/data/constrf.data';
-ERROR:  copy: line 2, CopyFrom: rejected due to CHECK constraint copy_con
+ERROR:  copy: line 2, CopyFrom: rejected due to CHECK constraint "copy_con" on "copy_tbl"
 SELECT * FROM COPY_TBL;
  x |       y       | z 
 ---+---------------+---