Re: are primary keys always 'needed'

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Serge Fonville <serge(dot)fonville(at)gmail(dot)com>
Cc: postgresql novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: are primary keys always 'needed'
Date: 2010-02-28 17:04:42
Message-ID: 9886.1267376682@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Serge Fonville <serge(dot)fonville(at)gmail(dot)com> writes:
> Some have a serial that is used as a foreign key in another table.
> Some tables consist of a combination of two foreign keys (that are
> unique together) and a field that is uniquely related to that
> combination (but is not necessarily unique within the table)

BTW, I forgot to mention that it's perfectly reasonable to have a
multi-column primary key, which is what seems to be indicated in
this type of example. I wouldn't advocate making up a surrogate
primary key in a linking table, if the combination of its foreign
keys can do the job.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Glaesemann 2010-02-28 17:16:02 Re: are primary keys always 'needed'
Previous Message Tom Lane 2010-02-28 17:02:35 Re: are primary keys always 'needed'