From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> |
Cc: | Doug McNaught <doug(at)wireboard(dot)com>, Philip Warner <pjw(at)rhyme(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: SET NULL / SET NOT NULL |
Date: | 2002-02-22 01:19:29 |
Message-ID: | Pine.LNX.4.30.0202212012540.683-100000@peter.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Christopher Kings-Lynne writes:
> Should we come up with a syntax for changing nullability that allows for the
> future changing of column type? If so, then a syntaxes like these might be
> the way to go:
>
> ALTER TABLE blah ALTER COLUMN col DROP DEFAULT;
> ALTER TABLE blah ALTER COLUMN col SET DEFAULT 't';
This is standard.
> ALTER TABLE blah ALTER COLUMN col NULL;
> ALTER TABLE blah ALTER COLUMN col NOT NULL;
This is missing a verb. It can be read as "alter table blah, in
particular, alter column col, (and do what with?) NULL". Is the NULL part
of the identity of the column?
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;
This also avoids the confusing "NULL constraint", which does not say that
the column has to be NULL.
> ALTER TABLE blah ALTER COLUMN col varchar(50);
Here again, there should probably be at least one more word inserted, like
TYPE.
> If we just allow the full col spec we could one day support this:
>
> ALTER TABLE blah ALTER COLUMN col text boolean NOT NULL DEFAULT 'f';
Maybe ... ALTER COLUMN col TO text ...
> Is this the eventual goal? Will this cause shift/reduce errors? will we
> need to put the word 'SET' in after 'col'?
A shift/reduce conflict has never stopped us. ;-)
--
Peter Eisentraut peter_e(at)gmx(dot)net
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2002-02-22 01:21:57 | Re: \connect case-folding change maybe not such a good idea |
Previous Message | Rich Shepard | 2002-02-22 00:53:56 | Re: data mining or statistical analysis with postgresql |