Re: select based on multi-column primary keys

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: select based on multi-column primary keys
Date: 2007-01-21 15:28:38
Message-ID: 20070121152838.GB3533@phlogiston.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)crankycanuck(dot)ca
If they don't do anything, we don't need their acronym.
--Josh Hamilton, on the US FEMA

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Ezequias Rodrigues da Rocha 2007-01-21 18:41:15 Changing point for commas and commas for point
Previous Message Richard Broersma Jr 2007-01-20 04:57:37 Re: select based on multi-column primary keys