From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> |
Cc: | "Bruce Momjian - CVS" <momjian(at)postgresql(dot)org>, pgsql-committers(at)postgresql(dot)org |
Subject: | Re: pgsql/doc TODO |
Date: | 2002-07-30 19:31:23 |
Message-ID: | 18048.1028057483@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
"Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
>> Log message:
>> Fix from Neil Conway:
>>
>> < o ALTER TABLE ADD COLUMN column SET DEFAULT should
>> fill existing
> o ALTER TABLE ALTER COLUMN column SET DEFAULT
>> should fill existing
> Wha! Altering a column default surely shouldn't change existing nulls or
> something???? All you're saying is from now on, the default should be blah.
> Surely it was correct in the first place?
I agree with Chris --- ALTER COLUMN SET DEFAULT should *not* change any
existing data. (SQL92 thinks so too.) The real error in the original
TODO item was the reference to "SET DEFAULT", which is not the syntax
used in ADD COLUMN. I think the TODO item should read more like
"ALTER TABLE ADD COLUMN ... DEFAULT foo" should work
Right now we get
regression=# alter table foo add column bar int default 42;
ERROR: Adding columns with defaults is not implemented.
Add the column, then use ALTER TABLE SET DEFAULT.
The reason this is rejected is that per spec it ought to fill all rows
with 42, and we don't have code in place to do that. But our ALTER
COLUMN SET DEFAULT is not broken; it works per spec.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian - CVS | 2002-07-30 19:34:05 | pgsql/doc TODO |
Previous Message | Bruce Momjian | 2002-07-30 19:25:28 | Re: pgsql/src/backend/optimizer/prep/_deadcode pre ... |