Re: Avoiding "will create implicit index" NOTICE

From: Bryce Nesbitt <bryce2(at)obviously(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Avoiding "will create implicit index" NOTICE
Date: 2009-06-11 07:03:30
Message-ID: 4A30AC42.1060709@obviously.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hmm, no. I still get the NOTICE. How can I create the primary key
without triggering a NOTICE?

bnesbitt=> create unique index test_5_pkey on test_5 (userid, site_key);
CREATE INDEX

bnesbitt=> alter table test_5 add primary key (userid, site_key);
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index
"test_5_pkey1" for table "test_5"
ALTER TABLE

bnesbitt=> \d test_5
Table "public.test_5"
+-------------------+---------+-----------+
| Column | Type | Modifiers |
+-------------------+---------+-----------+
| userid | integer | not null |
| site_key | integer | not null |
| ranking_365 | integer | default 0 |
| downloads_total | integer | default 0 |
| ranking_total | integer | default 0 |
+-------------------+---------+-----------+
Indexes:
"test_5_pkey1" PRIMARY KEY, btree (userid, site_key)
"test_5_pkey" UNIQUE, btree (userid, site_key)
Foreign-key constraints:
"test_5_site_key_fkey" FOREIGN KEY (site_key) REFERENCES
contexts(context_key) ON DELETE CASCADE
"test_5_userid_fkey" FOREIGN KEY (userid) REFERENCES users(userid)
ON DELETE CASCADE

Bryce Nesbitt wrote:
> Thanks, that's good.
>
> Rob Sargent wrote:
>
>> create table junk_six (foo int)
>> create unique index junk_six_id on junk_six(foo)
>>
>
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2009-06-11 07:31:06 Re: Avoiding "will create implicit index" NOTICE
Previous Message Bryce Nesbitt 2009-06-11 06:20:41 Re: Avoiding "will create implicit index" NOTICE