Re: SET NULL / SET NOT NULL

From: "Zeugswetter Andreas SB SD" <ZeugswetterA(at)spardat(dot)at>
To: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SET NULL / SET NOT NULL
Date: 2002-02-20 08:34:29
Message-ID: 46C15C39FEB2C44BA555E356FBCD6FA41EB508@m0114.s-mxs.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> > I'm hoping to implement SET NULL / SET NOT NULL for 7.3
> >
> > I've been searching the SQL99 docs but I still can't figure out the syntax
> > for it.
>
> There isn't really a syntax for it. SQL only allows you to add table
> constraints, not column constraints. A NOT NULL constraint is a shorthand
> notation for a CHECK constraint, so to add a NOT NULL constraint you'd
> have to recognize CHECK constraints of the form CHECK (col IS NOT NULL)
> and handle them specially. To drop NOT NULL constraints, you'd use the
> regular ALTER TABLE blah DROP CONSTRAINT foo; where foo is the name of the
> NOT NULL constraint. The drawback is that NOT NULL constraints currently
> don't have a name stored.

While this would imho really be the intuitive approach, does the
feature of dropping a not null constraint really justify storing a name for
each and every one ? With the added complexity of automatically
generating a name that fits and is guaranteed unique (and prbably
predictable) ?

I guess I would rather invent syntax that does without a name.
On the other hand other db's have such syntax and still generate names
for not null constraints, thus allowing both ways of dropping the constraint,
so ...

Andreas

Browse pgsql-hackers by date

  From Date Subject
Next Message Jean-Michel POURE 2002-02-20 10:15:11 Re: UTF-8 data migration problem in Postgresql 7.2
Previous Message Jean-Michel POURE 2002-02-20 07:35:29 Re: UTF-8 data migration problem in Postgresql 7.2