Re: are primary keys always 'needed' - Mailing list pgsql-novice

From Tom Lane
Subject Re: are primary keys always 'needed'
Date
Msg-id 9886.1267376682@sss.pgh.pa.us
Whole thread Raw
In response to are primary keys always 'needed'  (Serge Fonville <serge.fonville@gmail.com>)
Responses Re: are primary keys always 'needed'  (Serge Fonville <serge.fonville@gmail.com>)
List pgsql-novice
Serge Fonville <serge.fonville@gmail.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

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: are primary keys always 'needed'
Next
From: Serge Fonville
Date:
Subject: Re: are primary keys always 'needed'