Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2aae35d

Browse files
committed
Mention the index name in 'could not create unique index' errors,
per suggestion from Rene Gollent.
1 parentb17b7fa commit2aae35d

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

‎src/backend/utils/sort/tuplesort.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
* Portions Copyright (c) 1994, Regents of the University of California
9292
*
9393
* IDENTIFICATION
94-
* $PostgreSQL: pgsql/src/backend/utils/sort/tuplesort.c,v 1.78 2007/09/01 18:47:39 tgl Exp $
94+
* $PostgreSQL: pgsql/src/backend/utils/sort/tuplesort.c,v 1.79 2007/10/29 21:31:28 tgl Exp $
9595
*
9696
*-------------------------------------------------------------------------
9797
*/
@@ -2720,7 +2720,8 @@ comparetup_index(const SortTuple *a, const SortTuple *b, Tuplesortstate *state)
27202720
if (state->enforceUnique&& !equal_hasnull&&tuple1!=tuple2)
27212721
ereport(ERROR,
27222722
(errcode(ERRCODE_UNIQUE_VIOLATION),
2723-
errmsg("could not create unique index"),
2723+
errmsg("could not create unique index \"%s\"",
2724+
RelationGetRelationName(state->indexRel)),
27242725
errdetail("Table contains duplicated values.")));
27252726

27262727
/*

‎src/test/regress/expected/alter_table.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ insert into atacc1 (test) values (2);
417417
-- add a unique constraint (fails)
418418
alter table atacc1 add constraint atacc_test1 unique (test);
419419
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "atacc_test1" for table "atacc1"
420-
ERROR: could not create unique index
420+
ERROR: could not create unique index "atacc_test1"
421421
DETAIL: Table contains duplicated values.
422422
insert into atacc1 (test) values (3);
423423
drop table atacc1;
@@ -485,7 +485,7 @@ insert into atacc1 (test) values (2);
485485
-- add a primary key (fails)
486486
alter table atacc1 add constraint atacc_test1 primary key (test);
487487
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "atacc_test1" for table "atacc1"
488-
ERROR: could not create unique index
488+
ERROR: could not create unique index "atacc_test1"
489489
DETAIL: Table contains duplicated values.
490490
insert into atacc1 (test) values (3);
491491
drop table atacc1;

‎src/test/regress/expected/create_index.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ INSERT INTO concur_heap VALUES ('b','x');
389389
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);
392-
ERROR: could not create unique index
392+
ERROR: could not create unique index "concur_index3"
393393
DETAIL: Table contains duplicated values.
394394
-- test that expression indexes and partial indexes work concurrently
395395
CREATE INDEX CONCURRENTLY concur_index4 on concur_heap(f2) WHERE f1='a';

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp