Re: SET NULL / SET NOT NULL - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject Re: SET NULL / SET NOT NULL
Date
Msg-id GNELIHDDFBOCMGBFGEFOEENLCBAA.chriskl@familyhealth.com.au
Whole thread Raw
In response to Re: SET NULL / SET NOT NULL  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List pgsql-hackers
> ALTER TABLE blah ALTER [COLUMN] col SET NOT NULL;
>
> and
>
> ALTER TABLE blah ALTER [COLUMN] col DROP NOT NULL;
>
> This is synchronous with the SET/DROP default stuff and is
> extensible in the
> future to fit in with column type changing.
>
> Of course, it can always be changed in the parser without
> affecting my code.

Also, in the future, once (if) the 'SET TYPE' column type changing function
has been implemented, we can create a meta-command to do it all in one
statement (for reliability and consistency for users).  It could look like
this:

ALTER TABLE blah ALTER [COLUMN] col [SET TYPE type] [{SET | DROP} NOT NULL]
[{SET | DROP} DEFAULT [default]]

And a command like this should be able to just re-use already written code.
However, some interdependency checks might be more efficient if their done
before any changes are actually made!  ie. Changing type to boolean and then
setting default to 'blah' in one statement, etc.

Chris



pgsql-hackers by date:

Previous
From: Ulrich Neumann
Date:
Subject: Antw: Re: patch for include/utils/datetime.h to target NetWare
Next
From: Tom Lane
Date:
Subject: Re: views on temp tables