Hi,
when primary key or unique index is created using explicit name, strange
notice will say that implicit name was generated. But it didnt.
# select version();
PostgreSQL 8.4.1 on i686-pc-linux-gnu, compiled by GCC
i686-pc-linux-gnu-gcc (Gentoo 4.3.4 p1.0, pie-10.1.5) 4.3.4, 32-bit
# create table dummy(x integer, y integer);
CREATE TABLE
# alter table dummy add constraint pk_dummy_x primary key (x);
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index
"pk_dummy_x" for table "dummy"
ALTER TABLE
Maybe problem in src/backend/commands/indexcmds.c. Untested patch attached.
Regards, Tomas Psika
*** src/backend/commands/indexcmds.c.bak 2009-09-19 11:56:57.000000000 +0200
--- src/backend/commands/indexcmds.c 2009-09-19 12:09:17.000000000 +0200
***************
*** 127,132 ****
--- 127,133 ----
Datum reloptions;
int16 *coloptions;
IndexInfo *indexInfo;
+ bool implicitNameUsed = false;
int numberOfAttributes;
VirtualTransactionId *old_lockholders;
VirtualTransactionId *old_snapshots;
***************
*** 242,247 ****
--- 243,250 ----
*/
if (indexRelationName == NULL)
{
+ implicitNameUsed = true;
+
if (primary)
indexRelationName = ChooseRelationName(RelationGetRelationName(rel),
NULL,
***************
*** 430,436 ****
* Report index creation if appropriate (delay this till after most of the
* error checks)
*/
! if (isconstraint && !quiet)
ereport(NOTICE,
(errmsg("%s %s will create implicit index \"%s\" for table \"%s\"",
is_alter_table ? "ALTER TABLE / ADD" : "CREATE TABLE /",
--- 433,439 ----
* Report index creation if appropriate (delay this till after most of the
* error checks)
*/
! if (isconstraint && implicitNameUsed && !quiet)
ereport(NOTICE,
(errmsg("%s %s will create implicit index \"%s\" for table \"%s\"",
is_alter_table ? "ALTER TABLE / ADD" : "CREATE TABLE /",