pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bryce Nesbitt <bryce2@obviously.com>
To: pgsql-sql@postgresql.org
Subject: Re: Avoiding "will create implicit index" NOTICE
Date: Thu, 11 Jun 2009 00:03:30 -0700
Message-ID: <4A30AC42.1060709@obviously.com> (raw)
In-Reply-To: <4A30A239.8080700@obviously.com>
References: <4A242CC4.5000400@obviously.com>
	<5c4ddc540906011321v2162f928v451cca8833a44e20@mail.gmail.com>
	<4A30A239.8080700@obviously.com>

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)
>>     
>
>   



view thread (6+ messages)  latest in thread

Message-ID: <4A30AC42.1060709@obviously.com>
Permalink:  ../4A30AC42.1060709@obviously.com/
Also on:    postgresql.org/message-id/4A30AC42.1060709@obviously.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bryce2@obviously.com
  Subject: Re: Avoiding "will create implicit index" NOTICE
  In-Reply-To: <4A30AC42.1060709@obviously.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox