Re: Composite primary keys

Поиск
Список
Период
Сортировка
От Joshua Tolley
Тема Re: Composite primary keys
Дата
Msg-id 20090623184412.GG27474@eddie
обсуждение исходный текст
Ответ на Composite primary keys  (Harald Fuchs <hari.fuchs@gmail.com>)
Ответы Re: Composite primary keys  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
On Tue, Jun 23, 2009 at 05:14:36PM +0200, Harald Fuchs wrote:
>   test=# CREATE TABLE t2 (
>   test(#   id int NOT NULL REFERENCES t1,
>   test(#   language char(3) NULL,
>   test(#   txt text NOT NULL,
>   test(#   PRIMARY KEY (id, language)
>   test(# );
>   CREATE TABLE

<snip>

>   test=# INSERT INTO t2 (id, language, txt) VALUES (2, NULL, 'text 1 no language');
>   ERROR:  null value in column "language" violates not-null constraint

Primary keys are NOT NULL and UNIQUE. You can't have null values in a primary
key.

- Josh / eggyknap

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

Предыдущее
От: "Oliveiros Cristina"
Дата:
Сообщение: Re: Composite primary keys
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Composite primary keys