Re: Not null contraints

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Tamsin <tg_mail(at)bryncadfan(dot)co(dot)uk>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Not null contraints
Date: 2000-10-14 15:50:21
Message-ID: Pine.BSF.4.10.10010140845310.60581-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Sat, 14 Oct 2000, Philip Warner wrote:

> At 02:02 14/10/00 -0400, Tom Lane wrote:
> >>> Yup, that should do the trick. Not much magic here...
> >
> >> Just to confirm - does this mean we have ALTER TABLE ADD CONSTRAINT, but
> >> not ALTER TABLE DROP CONSTRAINT. If so, should it go on a list somewhere?
> >
> >No, it just means that NOT NULL constraint is handled via a special
> >flag attached to the column's pg_attribute entry.
>
> So there is no 'ALTER TABLE ALTER <field> ALLOW NULLS' or whatever.

I wonder how you actually are supposed to add and remove NOT NULL
constraints. ALTER TABLE ADD/DROP constraint work on table constraints,
and I don't think NOT NULL is among them, and I don't actually see
anything in spec beyond changing defaults and dropping for existing
columns.

>
> >Another relevant comment is that *removing* a NOT NULL constraint
> >doesn't pose any risk of creating invalid entries in the table data.
> >So there's no need to worry about cross-checking.
>
> This should apply to removing *any* constraint AFAICT...

True, but there might be cases in which removing a constraint invalidates
another one (removing the unique constraint that a foreign key constraint
references - not that we do anything about this yet)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2000-10-14 16:19:59 Re: config
Previous Message Vince Vielhaber 2000-10-14 14:31:22 Re: Question about pg_dump