Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 000119FB5DB for ; Tue, 23 Jan 2007 17:03:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 97446-07 for ; Tue, 23 Jan 2007 17:03:35 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id CA9AD9FB5DC for ; Tue, 23 Jan 2007 17:03:42 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 9EA2230E2B; Tue, 23 Jan 2007 22:03:41 +0100 (MET) From: "codeWarrior" X-Newsgroups: pgsql.sql Subject: Re: select based on multi-column primary keys Date: Tue, 23 Jan 2007 13:07:19 -0800 Organization: iDynaTECH, Inc. Lines: 58 Message-ID: References: <45B16602.2080508@furthernorth.net> <20070121152838.GB3533@phlogiston.dyndns.org> Reply-To: "codeWarrior" X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 To: pgsql-sql@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.203 tagged_above=0 required=5 tests=AWL, BAYES_50, FORGED_HOTMAIL_RCVD2 X-Spam-Level: * X-Archive-Number: 200701/116 X-Sequence-Number: 27268 No... its a table constraint using a unique, implicit index on the listed columns. . PRIMARY KEY ( column [, ...] ) The PRIMARY KEY table constraint is similar to the PRIMARY KEY column constraint. As a table constraint, PRIMARY KEY allows multiple columns to be defined in a parenthetical expression, separated by commas. An implicit index will be created across columns. The combination of values for each column specified must therefore amount to only unique and non-NULL values, as with the PRIMARY KEY column constraint. hehehe.... "Andrew Sullivan" wrote in message news:20070121152838.GB3533@phlogiston.dyndns.org... > On Fri, Jan 19, 2007 at 07:45:40PM -0800, codeWarrior wrote: >> AFAIK: You cannot have multiple primary keys. How would you know which >> one >> is the actual key ? > > You can have a multi-column primary key, though. That's a perfectly > legitimate approach. > >> FYI: What you are really talking about are table contraints... When you >> have > > No, it's a multi-column primary key. > >> My advice would be to alter your table structure so that you have a >> "real" >> PK not table constraints -- that would make it searchable.... > > This is already searchable. What you are talking about is not a real > primary key, but an artificial one. The OP already has a real > primary key. SQL purists think artificial primary keys mean that you > haven't done enough normalisation. I'm going to remain silent on > that topic, though, so that we don't get a Thread That Does Not End > :) > > A > > > -- > Andrew Sullivan | ajs@crankycanuck.ca > If they don't do anything, we don't need their acronym. > --Josh Hamilton, on the US FEMA > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly >