Re: PRIMARY KEYS

From: Erik Price <eprice(at)ptc(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: PRIMARY KEYS
Date: 2003-05-22 12:03:34
Message-ID: 3ECCBC96.3070405@ptc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn van Oosterhout wrote:
> On Wed, May 21, 2003 at 12:02:01PM -0400, Vivek Khera wrote:
>
>>>>>>>"MvO" == Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
>>
>>MvO> Number or Drivers Licence number as primary key is forbidden. If
>>MvO> you're permitted to have the information you're allowed to store
>>MvO> it but you sure as hell can't index your filing cabinets on it or
>>MvO> make it a primary key.
>>
>>What exactly is the difference between
>>
>>UNIQUE INDEX on a NOT NULL column of driver license numbers with no
>>other primary key on that table
>>
>>and
>>
>>PRIMARY KEY on that same column?
>>
>>The only thing that changed was the name.
>
>
> There's no *technical* difference, but a very large semantic difference.
> Whatever you use as your primary will become prolific.

One technical difference is that if you declare a column as a FOREIGN
KEY referencing another table without specifying a column within that
table, then the PRIMARY KEY of that table will be used as the target of
the FOREIGN KEY.

I think.

Erik

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Holger Klawitter 2003-05-22 13:19:13 BUG in lower
Previous Message Csaba Nagy 2003-05-22 11:27:35 Binary files in CVS