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

Поиск
Список
Период
Сортировка
От BigSmoke
Тема Re: unique constraint instead of primary key? what disadvantage(ODBC usage)?
Дата
Msg-id 1139502179.764894.35960@o13g2000cwo.googlegroups.com
обсуждение исходный текст
Ответ на unique constraint instead of primary key? what disadvantage(ODBC usage)?  (george young <gry@ll.mit.edu>)
Ответы Re: unique constraint instead of primary key? what disadvantage(ODBC usage)?
Re: unique constraint instead of primary key? what
Список 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 по дате отправления:

Предыдущее
От: "BigSmoke"
Дата:
Сообщение: Re: Non Matching Records in Two Tables
Следующее
От: Andreas Roth
Дата:
Сообщение: Change definition of a view