Re: Is a primary key made of a couple columns so much better than a unique() constraint ?

From: David Pradier <david(dot)pradier(at)clarisys(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: Is a primary key made of a couple columns so much better than a unique() constraint ?
Date: 2005-10-10 15:30:26
Message-ID: 20051010153026.GC12162@clarisys.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Just for the sake of completeness, there are exactly two differences:
> * PRIMARY KEY implies NOT NULL on the key columns; UNIQUE doesn't.
> * PRIMARY KEY creates a default target for foreign key references,
> ie, if you've declared a primary key then you can later just say
> "REFERENCES mytab" instead of spelling out "REFERENCES mytab(keycol)".
> So "UNIQUE + NOT NULL" is pretty dang close to the same as "PRIMARY
> KEY", but not quite.
> regards, tom lane

Thanks too, Tom :-)

Best regards,
David

--
David Pradier -- Directeur Technique de Clarisys Informatique -- Chef de projet logiciels libres / open-source

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-10-10 15:36:44 Re: strange error
Previous Message Tom Lane 2005-10-10 15:22:11 Re: Is a primary key made of a couple columns so much better than a unique() constraint ?