Re: SET NULL / SET NOT NULL

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Zeugswetter Andreas SB SD <ZeugswetterA(at)spardat(dot)at>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SET NULL / SET NOT NULL
Date: 2002-03-26 05:59:06
Message-ID: 20020325214602.E47891-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Tue, 26 Mar 2002, Christopher Kings-Lynne wrote:

> > Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> writes:
> > > I have throught of at least two problems with changing nullability. The
> > > first is primary keys. I have to prevent people setting a
> > column involved
> > > in a PK to null, right?
> >
> > Probably so.
>
> And foreign keys - foreign keys only have to reference UNIQUE, right? The
> nullability isn't an issue?

That should be fine.

> Lastly - in a multicolumn primary key, does EVERY column in the key need to
> be NOT NULL?

Well, it looks like the primary key will not be satisfied if any of the
values are NULL.

In my SQL 92 draft, 11.7 Syntax Rules 3a says:
If the <unique specification> specifies PRIMARY KEY, then let
SC be the <search condition>:

UNIQUE ( SELECT UCL FROM TN )
AND
( UCL ) IS NOT NULL

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nicolas Bazin 2002-03-26 06:21:31 build of 7.2.1 on SCO Openserver and Unixware 7.1.1
Previous Message Tom Lane 2002-03-26 05:42:46 Re: Rolling v7.2.1 ...