Re: select based on multi-column primary keys - Mailing list pgsql-sql

From Andrew Sullivan
Subject Re: select based on multi-column primary keys
Date
Msg-id 20070121152838.GB3533@phlogiston.dyndns.org
Whole thread Raw
In response to Re: select based on multi-column primary keys  ("codeWarrior" <gpatnude@hotmail.com>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Richard Broersma Jr
Date:
Subject: Re: select based on multi-column primary keys
Next
From: "Ezequias Rodrigues da Rocha"
Date:
Subject: Changing point for commas and commas for point