Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 4B9F29FB55B for ; Sun, 21 Jan 2007 11:28:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 26599-10 for ; Sun, 21 Jan 2007 11:28:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) by postgresql.org (Postfix) with ESMTP id 59CC69FB301 for ; Sun, 21 Jan 2007 11:28:50 -0400 (AST) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] helo=phlogiston.dydns.org) by main2.mycybernet.net with esmtp (Exim 4.62) (envelope-from ) id 1H8emz-0002h5-SS for pgsql-sql@postgresql.org; Sun, 21 Jan 2007 10:39:25 -0500 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id D8B1C41A2; Sun, 21 Jan 2007 10:28:38 -0500 (EST) Date: Sun, 21 Jan 2007 10:28:38 -0500 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: select based on multi-column primary keys Message-ID: <20070121152838.GB3533@phlogiston.dyndns.org> References: <45B16602.2080508@furthernorth.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/90 X-Sequence-Number: 27242 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