Re: Composite primary keys - Mailing list pgsql-sql

From Joshua Tolley
Subject Re: Composite primary keys
Date
Msg-id 20090623184412.GG27474@eddie
Whole thread Raw
In response to Composite primary keys  (Harald Fuchs <hari.fuchs@gmail.com>)
Responses Re: Composite primary keys
List 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 by date:

Previous
From: "Oliveiros Cristina"
Date:
Subject: Re: Composite primary keys
Next
From: Tom Lane
Date:
Subject: Re: Composite primary keys