Re: Unique index VS unique constraint

Поиск
Список
Период
Сортировка
От lucazeo@gmail.com
Тема Re: Unique index VS unique constraint
Дата
Msg-id 524EFDBD.9010204@gmail.com
обсуждение исходный текст
Ответ на Unique index VS unique constraint  (JORGE MALDONADO <jorgemal1960@gmail.com>)
Ответы Re: Unique index VS unique constraint  (Adrian Klaver <adrian.klaver@gmail.com>)
Список pgsql-sql
Il 04/10/2013 18:48, JORGE MALDONADO ha scritto:
> I have search for information about the difference between "unique 
> index" and "unique constraint" in PostgreSQL without getting to a 
> specific answer, so I kindly ask for an explanation that helps me 
> clarify such concept.

2 main differences.

First is the meaning: primary key identifies a record. A unique just 
tells you that that value of the record, in the table is unique. If you 
use keys, db structure will be more intelligible (my opinion).

Second one is functional: in an unique constraint you can allow NULL 
values and ignore them. A primary key does not allow this.

> Respectfully,
> Jorge Maldonado

Regards,

Luca.



В списке pgsql-sql по дате отправления:

Предыдущее
От: JORGE MALDONADO
Дата:
Сообщение: Unique index VS unique constraint
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Unique index VS unique constraint