Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7312c19

Browse files
committed
Change messages like this:
ERROR: ExecInsert: rejected due to CHECK constraint insert_con To be like this: ERROR: ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl" Updated regression tests to match. I got sick of seeing 'rejected due to CHECK constraint "$1" in my log and not being able to find the bug in our website code... Christopher Kings-Lynne
1 parent ce5bb92 commit 7312c19

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

src/backend/executor/execMain.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
*
2929
* IDENTIFICATION
30-
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.171 2002/07/20 05:16:57 momjian Exp $
30+
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.172 2002/08/04 05:04:39 momjian Exp $
3131
*
3232
*-------------------------------------------------------------------------
3333
*/
@@ -1582,8 +1582,8 @@ ExecConstraints(const char *caller, ResultRelInfo *resultRelInfo,
15821582
char *failed;
15831583

15841584
if ((failed = ExecRelCheck(resultRelInfo, slot, estate)) != NULL)
1585-
elog(ERROR, "%s: rejected due to CHECK constraint %s",
1586-
caller, failed);
1585+
elog(ERROR, "%s: rejected due to CHECK constraint \"%s\" on \"%s\"",
1586+
caller, failed, RelationGetRelationName(rel));
15871587
}
15881588
}
15891589

src/test/regress/output/constraints.source

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ CREATE TABLE CHECK_TBL (x int,
6262
INSERT INTO CHECK_TBL VALUES (5);
6363
INSERT INTO CHECK_TBL VALUES (4);
6464
INSERT INTO CHECK_TBL VALUES (3);
65-
ERROR: ExecInsert: rejected due to CHECK constraint check_con
65+
ERROR: ExecInsert: rejected due to CHECK constraint "check_con" on "check_tbl"
6666
INSERT INTO CHECK_TBL VALUES (2);
67-
ERROR: ExecInsert: rejected due to CHECK constraint check_con
67+
ERROR: ExecInsert: rejected due to CHECK constraint "check_con" on "check_tbl"
6868
INSERT INTO CHECK_TBL VALUES (6);
6969
INSERT INTO CHECK_TBL VALUES (1);
70-
ERROR: ExecInsert: rejected due to CHECK constraint check_con
70+
ERROR: ExecInsert: rejected due to CHECK constraint "check_con" on "check_tbl"
7171
SELECT '' AS three, * FROM CHECK_TBL;
7272
three | x
7373
-------+---
@@ -82,13 +82,13 @@ CREATE TABLE CHECK2_TBL (x int, y text, z int,
8282
CHECK (x > 3 and y <> 'check failed' and z < 8));
8383
INSERT INTO CHECK2_TBL VALUES (4, 'check ok', -2);
8484
INSERT INTO CHECK2_TBL VALUES (1, 'x check failed', -2);
85-
ERROR: ExecInsert: rejected due to CHECK constraint sequence_con
85+
ERROR: ExecInsert: rejected due to CHECK constraint "sequence_con" on "check2_tbl"
8686
INSERT INTO CHECK2_TBL VALUES (5, 'z check failed', 10);
87-
ERROR: ExecInsert: rejected due to CHECK constraint sequence_con
87+
ERROR: ExecInsert: rejected due to CHECK constraint "sequence_con" on "check2_tbl"
8888
INSERT INTO CHECK2_TBL VALUES (0, 'check failed', -2);
89-
ERROR: ExecInsert: rejected due to CHECK constraint sequence_con
89+
ERROR: ExecInsert: rejected due to CHECK constraint "sequence_con" on "check2_tbl"
9090
INSERT INTO CHECK2_TBL VALUES (6, 'check failed', 11);
91-
ERROR: ExecInsert: rejected due to CHECK constraint sequence_con
91+
ERROR: ExecInsert: rejected due to CHECK constraint "sequence_con" on "check2_tbl"
9292
INSERT INTO CHECK2_TBL VALUES (7, 'check ok', 7);
9393
SELECT '' AS two, * from CHECK2_TBL;
9494
two | x | y | z
@@ -107,7 +107,7 @@ CREATE TABLE INSERT_TBL (x INT DEFAULT nextval('insert_seq'),
107107
CONSTRAINT INSERT_CON CHECK (x >= 3 AND y <> 'check failed' AND x < 8),
108108
CHECK (x + z = 0));
109109
INSERT INTO INSERT_TBL(x,z) VALUES (2, -2);
110-
ERROR: ExecInsert: rejected due to CHECK constraint insert_con
110+
ERROR: ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
111111
SELECT '' AS zero, * FROM INSERT_TBL;
112112
zero | x | y | z
113113
------+---+---+---
@@ -120,13 +120,13 @@ SELECT 'one' AS one, nextval('insert_seq');
120120
(1 row)
121121

122122
INSERT INTO INSERT_TBL(y) VALUES ('Y');
123-
ERROR: ExecInsert: rejected due to CHECK constraint insert_con
123+
ERROR: ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
124124
INSERT INTO INSERT_TBL(y) VALUES ('Y');
125125
INSERT INTO INSERT_TBL(x,z) VALUES (1, -2);
126-
ERROR: ExecInsert: rejected due to CHECK constraint $1
126+
ERROR: ExecInsert: rejected due to CHECK constraint "$1" on "insert_tbl"
127127
INSERT INTO INSERT_TBL(z,x) VALUES (-7, 7);
128128
INSERT INTO INSERT_TBL VALUES (5, 'check failed', -5);
129-
ERROR: ExecInsert: rejected due to CHECK constraint insert_con
129+
ERROR: ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
130130
INSERT INTO INSERT_TBL VALUES (7, '!check failed', -7);
131131
INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-');
132132
SELECT '' AS four, * FROM INSERT_TBL;
@@ -139,9 +139,9 @@ SELECT '' AS four, * FROM INSERT_TBL;
139139
(4 rows)
140140

141141
INSERT INTO INSERT_TBL(y,z) VALUES ('check failed', 4);
142-
ERROR: ExecInsert: rejected due to CHECK constraint $1
142+
ERROR: ExecInsert: rejected due to CHECK constraint "$1" on "insert_tbl"
143143
INSERT INTO INSERT_TBL(x,y) VALUES (5, 'check failed');
144-
ERROR: ExecInsert: rejected due to CHECK constraint insert_con
144+
ERROR: ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
145145
INSERT INTO INSERT_TBL(x,y) VALUES (5, '!check failed');
146146
INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-');
147147
SELECT '' AS six, * FROM INSERT_TBL;
@@ -162,7 +162,7 @@ SELECT 'seven' AS one, nextval('insert_seq');
162162
(1 row)
163163

164164
INSERT INTO INSERT_TBL(y) VALUES ('Y');
165-
ERROR: ExecInsert: rejected due to CHECK constraint insert_con
165+
ERROR: ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
166166
SELECT 'eight' AS one, currval('insert_seq');
167167
one | currval
168168
-------+---------
@@ -193,11 +193,11 @@ CREATE TABLE INSERT_CHILD (cx INT default 42,
193193
INHERITS (INSERT_TBL);
194194
INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,11);
195195
INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,6);
196-
ERROR: ExecInsert: rejected due to CHECK constraint insert_child_cy
196+
ERROR: ExecInsert: rejected due to CHECK constraint "insert_child_cy" on "insert_child"
197197
INSERT INTO INSERT_CHILD(x,z,cy) VALUES (6,-7,7);
198-
ERROR: ExecInsert: rejected due to CHECK constraint $1
198+
ERROR: ExecInsert: rejected due to CHECK constraint "$1" on "insert_child"
199199
INSERT INTO INSERT_CHILD(x,y,z,cy) VALUES (6,'check failed',-6,7);
200-
ERROR: ExecInsert: rejected due to CHECK constraint insert_con
200+
ERROR: ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_child"
201201
SELECT * FROM INSERT_CHILD;
202202
x | y | z | cx | cy
203203
---+--------+----+----+----
@@ -227,7 +227,7 @@ SELECT '' AS three, * FROM INSERT_TBL;
227227
INSERT INTO INSERT_TBL SELECT * FROM tmp WHERE yd = 'try again';
228228
INSERT INTO INSERT_TBL(y,z) SELECT yd, -7 FROM tmp WHERE yd = 'try again';
229229
INSERT INTO INSERT_TBL(y,z) SELECT yd, -8 FROM tmp WHERE yd = 'try again';
230-
ERROR: ExecInsert: rejected due to CHECK constraint insert_con
230+
ERROR: ExecInsert: rejected due to CHECK constraint "insert_con" on "insert_tbl"
231231
SELECT '' AS four, * FROM INSERT_TBL;
232232
four | x | y | z
233233
------+---+---------------+----
@@ -246,7 +246,7 @@ UPDATE INSERT_TBL SET x = NULL WHERE x = 5;
246246
UPDATE INSERT_TBL SET x = 6 WHERE x = 6;
247247
UPDATE INSERT_TBL SET x = -z, z = -x;
248248
UPDATE INSERT_TBL SET x = z, z = x;
249-
ERROR: ExecUpdate: rejected due to CHECK constraint insert_con
249+
ERROR: ExecUpdate: rejected due to CHECK constraint "insert_con" on "insert_tbl"
250250
SELECT * FROM INSERT_TBL;
251251
x | y | z
252252
---+---------------+----
@@ -273,7 +273,7 @@ SELECT '' AS two, * FROM COPY_TBL;
273273
(2 rows)
274274

275275
COPY COPY_TBL FROM '@abs_srcdir@/data/constrf.data';
276-
ERROR: copy: line 2, CopyFrom: rejected due to CHECK constraint copy_con
276+
ERROR: copy: line 2, CopyFrom: rejected due to CHECK constraint "copy_con" on "copy_tbl"
277277
SELECT * FROM COPY_TBL;
278278
x | y | z
279279
---+---------------+---

0 commit comments

Comments
 (0)