Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 1BDF563275B for ; Thu, 11 Jun 2009 04:03:36 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 16778-01 for ; Thu, 11 Jun 2009 04:03:29 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outA.internet-mail-service.net (outa.internet-mail-service.net [216.240.47.224]) by mail.postgresql.org (Postfix) with ESMTP id 9E709632557 for ; Thu, 11 Jun 2009 04:03:32 -0300 (ADT) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id 66858B994B for ; Thu, 11 Jun 2009 00:03:31 -0700 (PDT) X-Client-Authorized: MaGic Cook1e Received: from [192.168.2.103] (adsl-71-135-172-202.dsl.pltn13.pacbell.net [71.135.172.202]) by idiom.com (Postfix) with ESMTP id C12652D6004 for ; Thu, 11 Jun 2009 00:03:30 -0700 (PDT) Message-ID: <4A30AC42.1060709@obviously.com> Date: Thu, 11 Jun 2009 00:03:30 -0700 From: Bryce Nesbitt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.19) Gecko/20081213 SUSE/1.1.14-1.1 SeaMonkey/1.1.14 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: Avoiding "will create implicit index" NOTICE References: <4A242CC4.5000400@obviously.com> <5c4ddc540906011321v2162f928v451cca8833a44e20@mail.gmail.com> <4A30A239.8080700@obviously.com> In-Reply-To: <4A30A239.8080700@obviously.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200906/49 X-Sequence-Number: 32654 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) >> > >