Re: unique constraint instead of primary key? what disadvantage(ODBC usage)?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "BigSmoke" <bigsmoke(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: unique constraint instead of primary key? what disadvantage(ODBC usage)?
Date: 2006-02-09 17:12:35
Message-ID: 2303.1139505155@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"BigSmoke" <bigsmoke(at)gmail(dot)com> writes:
> As far as I know, though, PRIMARY KEY does the same thing as UNIQUE NOT
> NULL in PostgreSQL.

They are 99.9% the same --- the *only* difference AFAIR is that PRIMARY
KEY establishes a default column-to-reference for FOREIGN KEY references
to the table. UNIQUE doesn't; you can make a FOREIGN KEY reference to a
column that's only UNIQUE, but you'll always have to specify which column.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Keith Worthington 2006-02-09 18:09:04 Re: Change definition of a view
Previous Message Andreas Roth 2006-02-09 17:11:24 Change definition of a view