PRIMARY KEY on a *group* of columns imply that each column is NOT NULL?

From: Stephane Bortzmeyer <bortzmeyer(at)nic(dot)fr>
To: pgsql-general(at)postgresql(dot)org
Subject: PRIMARY KEY on a *group* of columns imply that each column is NOT NULL?
Date: 2005-04-26 20:03:46
Message-ID: 20050426200346.GA13442@sources.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

If I define a primary key:

name TEXT NOT NULL,
address INET,
PRIMARY KEY(name, address)

the definition (seen by \d) becomes:

name | text | not null
address | inet | not null

"address" is now not null, which I do not want. It seems unnecessary:
I just want the tuple (name, address) to be unique, which seems
possible even if some 'address' values are NULL.

It does not appear to be documented in
http://www.postgresql.org/docs/7.4/interactive/ddl-constraints.html#AEN1975.
Is there a workaround?

Browse pgsql-general by date

  From Date Subject
Next Message Steve - DND 2005-04-26 20:05:02 plruby on Windows
Previous Message Chris Browne 2005-04-26 19:51:43 Re: OpenRPT