Re: unique constraint instead of primary key? what disadvantage(ODBC usage)? - Mailing list pgsql-sql

From BigSmoke
Subject Re: unique constraint instead of primary key? what disadvantage(ODBC usage)?
Date
Msg-id 1139502179.764894.35960@o13g2000cwo.googlegroups.com
Whole thread Raw
In response to unique constraint instead of primary key? what disadvantage(ODBC usage)?  (george young <gry@ll.mit.edu>)
Responses Re: unique constraint instead of primary key? what disadvantage(ODBC usage)?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: unique constraint instead of primary key? what  (george young <gry@ll.mit.edu>)
List pgsql-sql
If my tables have one or more UNIQUE constraints/indices, I still add a
"id SERIAL PRIMARY KEY" field to most of my tables. This makes
referencing easier and faster. It also improves consistency, which is
never a bad thing in my opinion.

As far as I know, though, PRIMARY KEY does the same thing as UNIQUE NOT
NULL in PostgreSQL.

The reason that PRIMARY KEY can't be NULL and _has to be_ UNIQUE is
that it is the primary means of identifying a given record in a table.
If you don't have PRIMARY KEY that is UNIQUE and NOT NULL, how are you
going to identify (or reference) individual records? PostgreSQL won't
allow you to reference more than one row for what I came to believe are
very good reasons.
 - Rowan



pgsql-sql by date:

Previous
From: "BigSmoke"
Date:
Subject: Re: Non Matching Records in Two Tables
Next
From: Andreas Roth
Date:
Subject: Change definition of a view