Skip to content

Commit f4a3789

Browse files
committed
Clarify some error messages about duplicate things.
1 parent 55477d7 commit f4a3789

File tree

13 files changed

+32
-32
lines changed

13 files changed

+32
-32
lines changed

src/backend/access/common/reloptions.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.4 2007/02/27 23:48:06 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.5 2007/06/03 22:16:02 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -206,7 +206,7 @@ parseRelOptions(Datum options, int numkeywords, const char *const * keywords,
206206
if (values[j] && validate)
207207
ereport(ERROR,
208208
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
209-
errmsg("duplicate parameter \"%s\"",
209+
errmsg("parameter \"%s\" specified more than once",
210210
keywords[j])));
211211
value_len = text_len - kw_len - 1;
212212
value = (char *) palloc(value_len + 1);

src/backend/access/nbtree/nbtinsert.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.157 2007/05/20 21:08:19 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.158 2007/06/03 22:16:02 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -287,7 +287,7 @@ _bt_check_unique(Relation rel, IndexTuple itup, Relation heapRel,
287287

288288
ereport(ERROR,
289289
(errcode(ERRCODE_UNIQUE_VIOLATION),
290-
errmsg("duplicate key violates unique constraint \"%s\"",
290+
errmsg("duplicate key value violates unique constraint \"%s\"",
291291
RelationGetRelationName(rel))));
292292
}
293293
else if (htup.t_data != NULL)

src/backend/catalog/heap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.321 2007/05/14 20:24:41 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.322 2007/06/03 22:16:02 petere Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -375,7 +375,7 @@ CheckAttributeNamesTypes(TupleDesc tupdesc, char relkind)
375375
NameStr(tupdesc->attrs[i]->attname)) == 0)
376376
ereport(ERROR,
377377
(errcode(ERRCODE_DUPLICATE_COLUMN),
378-
errmsg("column name \"%s\" is duplicated",
378+
errmsg("column name \"%s\" specified more than once",
379379
NameStr(tupdesc->attrs[j]->attname))));
380380
}
381381
}

src/backend/commands/tablecmds.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.226 2007/06/03 17:06:25 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.227 2007/06/03 22:16:03 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -791,7 +791,7 @@ MergeAttributes(List *schema, List *supers, bool istemp,
791791
if (strcmp(coldef->colname, restdef->colname) == 0)
792792
ereport(ERROR,
793793
(errcode(ERRCODE_DUPLICATE_COLUMN),
794-
errmsg("column \"%s\" duplicated",
794+
errmsg("column \"%s\" specified more than once",
795795
coldef->colname)));
796796
}
797797
}
@@ -839,7 +839,7 @@ MergeAttributes(List *schema, List *supers, bool istemp,
839839
if (list_member_oid(parentOids, RelationGetRelid(relation)))
840840
ereport(ERROR,
841841
(errcode(ERRCODE_DUPLICATE_TABLE),
842-
errmsg("inherited relation \"%s\" duplicated",
842+
errmsg("relation \"%s\" would be inherited from more than once",
843843
parent->relname)));
844844

845845
parentOids = lappend_oid(parentOids, RelationGetRelid(relation));
@@ -1139,7 +1139,7 @@ add_nonduplicate_constraint(Constraint *cdef, ConstrCheck *check, int *ncheck)
11391139
return; /* duplicate constraint, so ignore it */
11401140
ereport(ERROR,
11411141
(errcode(ERRCODE_DUPLICATE_OBJECT),
1142-
errmsg("duplicate check constraint name \"%s\"",
1142+
errmsg("check constraint name \"%s\" appears multiple times but with different expressions",
11431143
cdef->name)));
11441144
}
11451145
/* No match on name, so add it to array */
@@ -6013,7 +6013,7 @@ ATExecAddInherit(Relation child_rel, RangeVar *parent)
60136013
if (inh->inhparent == RelationGetRelid(parent_rel))
60146014
ereport(ERROR,
60156015
(errcode(ERRCODE_DUPLICATE_TABLE),
6016-
errmsg("inherited relation \"%s\" duplicated",
6016+
errmsg("relation \"%s\" would be inherited from more than once",
60176017
RelationGetRelationName(parent_rel))));
60186018
if (inh->inhseqno > inhseqno)
60196019
inhseqno = inh->inhseqno;

src/test/regress/expected/alter_table.out

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ alter table atacc3 add constraint foo check (test2>0);
360360
alter table atacc3 inherit atacc2;
361361
-- fail due to duplicates and circular inheritance
362362
alter table atacc3 inherit atacc2;
363-
ERROR: inherited relation "atacc2" duplicated
363+
ERROR: relation "atacc2" would be inherited from more than once
364364
alter table atacc2 inherit atacc3;
365365
ERROR: circular inheritance not allowed
366366
DETAIL: "atacc3" is already a child of "atacc2".
@@ -402,7 +402,7 @@ NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "atacc_test1" for t
402402
insert into atacc1 (test) values (2);
403403
-- should fail
404404
insert into atacc1 (test) values (2);
405-
ERROR: duplicate key violates unique constraint "atacc_test1"
405+
ERROR: duplicate key value violates unique constraint "atacc_test1"
406406
-- should succeed
407407
insert into atacc1 (test) values (4);
408408
-- try adding a unique oid constraint
@@ -437,7 +437,7 @@ NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "atacc_test1" for t
437437
insert into atacc1 (test,test2) values (4,4);
438438
-- should fail
439439
insert into atacc1 (test,test2) values (4,4);
440-
ERROR: duplicate key violates unique constraint "atacc_test1"
440+
ERROR: duplicate key value violates unique constraint "atacc_test1"
441441
-- should all succeed
442442
insert into atacc1 (test,test2) values (4,5);
443443
insert into atacc1 (test,test2) values (5,4);
@@ -451,7 +451,7 @@ NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "atacc1_test2_key"
451451
-- should fail for @@ second one @@
452452
insert into atacc1 (test2, test) values (3, 3);
453453
insert into atacc1 (test2, test) values (2, 3);
454-
ERROR: duplicate key violates unique constraint "atacc1_test_key"
454+
ERROR: duplicate key value violates unique constraint "atacc1_test_key"
455455
drop table atacc1;
456456
-- test primary key constraint adding
457457
create table atacc1 ( test int ) with oids;
@@ -462,7 +462,7 @@ NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "atacc_test1"
462462
insert into atacc1 (test) values (2);
463463
-- should fail
464464
insert into atacc1 (test) values (2);
465-
ERROR: duplicate key violates unique constraint "atacc_test1"
465+
ERROR: duplicate key value violates unique constraint "atacc_test1"
466466
-- should succeed
467467
insert into atacc1 (test) values (4);
468468
-- inserting NULL should fail
@@ -517,7 +517,7 @@ ERROR: multiple primary keys for table "atacc1" are not allowed
517517
insert into atacc1 (test,test2) values (4,4);
518518
-- should fail
519519
insert into atacc1 (test,test2) values (4,4);
520-
ERROR: duplicate key violates unique constraint "atacc_test1"
520+
ERROR: duplicate key value violates unique constraint "atacc_test1"
521521
insert into atacc1 (test,test2) values (NULL,3);
522522
ERROR: null value in column "test" violates not-null constraint
523523
insert into atacc1 (test,test2) values (3, NULL);
@@ -535,7 +535,7 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "atacc1_pkey" for
535535
-- only first should succeed
536536
insert into atacc1 (test2, test) values (3, 3);
537537
insert into atacc1 (test2, test) values (2, 3);
538-
ERROR: duplicate key violates unique constraint "atacc1_pkey"
538+
ERROR: duplicate key value violates unique constraint "atacc1_pkey"
539539
insert into atacc1 (test2, test) values (1, NULL);
540540
ERROR: null value in column "test" violates not-null constraint
541541
drop table atacc1;

src/test/regress/expected/arrays.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ insert into arr_tbl values ('{1,2,3}');
703703
insert into arr_tbl values ('{1,2}');
704704
-- failure expected:
705705
insert into arr_tbl values ('{1,2,3}');
706-
ERROR: duplicate key violates unique constraint "arr_tbl_f1_key"
706+
ERROR: duplicate key value violates unique constraint "arr_tbl_f1_key"
707707
insert into arr_tbl values ('{2,3,4}');
708708
insert into arr_tbl values ('{1,5,3}');
709709
insert into arr_tbl values ('{1,2,10}');

src/test/regress/expected/create_index.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ INSERT INTO func_index_heap VALUES('AB','CDEFG');
348348
INSERT INTO func_index_heap VALUES('QWE','RTY');
349349
-- this should fail because of unique index:
350350
INSERT INTO func_index_heap VALUES('ABCD', 'EF');
351-
ERROR: duplicate key violates unique constraint "func_index_index"
351+
ERROR: duplicate key value violates unique constraint "func_index_index"
352352
-- but this shouldn't:
353353
INSERT INTO func_index_heap VALUES('QWERTY');
354354
--
@@ -362,7 +362,7 @@ INSERT INTO func_index_heap VALUES('AB','CDEFG');
362362
INSERT INTO func_index_heap VALUES('QWE','RTY');
363363
-- this should fail because of unique index:
364364
INSERT INTO func_index_heap VALUES('ABCD', 'EF');
365-
ERROR: duplicate key violates unique constraint "func_index_index"
365+
ERROR: duplicate key value violates unique constraint "func_index_index"
366366
-- but this shouldn't:
367367
INSERT INTO func_index_heap VALUES('QWERTY');
368368
--
@@ -386,7 +386,7 @@ INSERT INTO concur_heap VALUES ('b','b');
386386
CREATE UNIQUE INDEX CONCURRENTLY concur_index2 ON concur_heap(f1);
387387
-- check if constraint is set up properly to be enforced
388388
INSERT INTO concur_heap VALUES ('b','x');
389-
ERROR: duplicate key violates unique constraint "concur_index2"
389+
ERROR: duplicate key value violates unique constraint "concur_index2"
390390
-- check if constraint is enforced properly at build time
391391
CREATE UNIQUE INDEX CONCURRENTLY concur_index3 ON concur_heap(f2);
392392
ERROR: could not create unique index

src/test/regress/expected/inherit.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ SELECT * FROM a; /* Has ee entry */
605605
(1 row)
606606

607607
CREATE TABLE inhf (LIKE inhx, LIKE inhx); /* Throw error */
608-
ERROR: column "xx" duplicated
608+
ERROR: column "xx" specified more than once
609609
CREATE TABLE inhf (LIKE inhx INCLUDING DEFAULTS INCLUDING CONSTRAINTS);
610610
INSERT INTO inhf DEFAULT VALUES;
611611
SELECT * FROM inhf; /* Single entry with value 'text' */

src/test/regress/expected/plpgsql.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ select * from PField_v1 where pfname = 'PF0_2' order by slotname;
15161516
-- Finally we want errors
15171517
--
15181518
insert into PField values ('PF1_1', 'should fail due to unique index');
1519-
ERROR: duplicate key violates unique constraint "pfield_name"
1519+
ERROR: duplicate key value violates unique constraint "pfield_name"
15201520
update PSlot set backlink = 'WS.not.there' where slotname = 'PS.base.a1';
15211521
ERROR: WS.not.there does not exist
15221522
CONTEXT: PL/pgSQL function "tg_backlink_a" line 16 at assignment
@@ -1530,7 +1530,7 @@ update PSlot set slotlink = 'XX.illegal' where slotname = 'PS.base.a1';
15301530
ERROR: illegal slotlink beginning with XX
15311531
CONTEXT: PL/pgSQL function "tg_slotlink_a" line 16 at assignment
15321532
insert into HSlot values ('HS', 'base.hub1', 1, '');
1533-
ERROR: duplicate key violates unique constraint "hslot_name"
1533+
ERROR: duplicate key value violates unique constraint "hslot_name"
15341534
insert into HSlot values ('HS', 'base.hub1', 20, '');
15351535
ERROR: no manual manipulation of HSlot
15361536
delete from HSlot;

src/test/regress/expected/transactions.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,13 +463,13 @@ BEGIN;
463463
NOTICE: CREATE TABLE / UNIQUE will create implicit index "koju_a_key" for table "koju"
464464
INSERT INTO koju VALUES (1);
465465
INSERT INTO koju VALUES (1);
466-
ERROR: duplicate key violates unique constraint "koju_a_key"
466+
ERROR: duplicate key value violates unique constraint "koju_a_key"
467467
rollback to x;
468468
CREATE TABLE koju (a INT UNIQUE);
469469
NOTICE: CREATE TABLE / UNIQUE will create implicit index "koju_a_key" for table "koju"
470470
INSERT INTO koju VALUES (1);
471471
INSERT INTO koju VALUES (1);
472-
ERROR: duplicate key violates unique constraint "koju_a_key"
472+
ERROR: duplicate key value violates unique constraint "koju_a_key"
473473
ROLLBACK;
474474
DROP TABLE foo;
475475
DROP TABLE baz;

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