pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joshua Tolley <eggyknap@gmail.com>
To: Harald Fuchs <hari.fuchs@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Composite primary keys
Date: Tue, 23 Jun 2009 12:44:12 -0600
Message-ID: <20090623184412.GG27474@eddie> (raw)
In-Reply-To: <pu1vpb2d9f.fsf@srv.protecting.net>
References: <pu1vpb2d9f.fsf@srv.protecting.net>

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

Attachments:

  signature.asc (application/pgp-signature, 196B) download

view thread (8+ messages)  latest in thread

Message-ID: <20090623184412.GG27474@eddie>
Permalink:  ../20090623184412.GG27474@eddie/
Also on:    postgresql.org/message-id/20090623184412.GG27474@eddie

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: eggyknap@gmail.com, hari.fuchs@gmail.com
  Subject: Re: Composite primary keys
  In-Reply-To: <20090623184412.GG27474@eddie>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox