Re: SET NULL / SET NOT NULL

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SET NULL / SET NOT NULL
Date: 2002-03-22 05:39:45
Message-ID: GNELIHDDFBOCMGBFGEFOKENGCBAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I'm halfway thru implementing setting a column's nullness (I've done
changing to null,
but not changing to not null)

Peter E. said:

> Using the standard precedent above, how about
>
> ALTER TABLE blah ALTER COLUMN col SET NOT NULL;
> ALTER TABLE blah ALTER COLUMN col DROP NOT NULL;

Do we want the above syntax, or this syntax:

ALTER TABLE blah ALTER COLUMN col SET NOT NULL;
ALTER TABLE blah ALTER COLUMN col SET NULL;

The former sort of treats it like a contraint, where as the latter treats it
as it is during the CREATE TABLE statement.

Say in the future we want to support changing column type as well. How
would we work that in?

ALTER TABLE blah ALTER COLUMN col SET int4; ??????

Then we should allow people to do this:

ALTER TABLE blah ALTER COLUMN col SET int4 NULL DEFAULT '3';

So they can change their entire column in one statement.

So really this implies that ALTER COLUMN/SET NULL is the correct syntax,
rather than ALTER COLUMN/DROP NOT NULL. In fact, maybe we could support
BOTH syntaxes...

Comments? Let's sort this out before I submit my patch.

Regards,

Chris

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-03-22 05:52:50 Re: SET NULL / SET NOT NULL
Previous Message Nicolas Bazin 2002-03-22 05:37:45 Re: Where to get official SQL spec (was Re: Domain Support)