Re: Alter table add column ignores default
От | Vince Vielhaber |
---|---|
Тема | Re: Alter table add column ignores default |
Дата | |
Msg-id | Pine.BSF.4.30.0105081115350.66156-100000@paprika.michvhf.com обсуждение исходный текст |
Ответ на | Re: Alter table add column ignores default (Nabil Sayegh <nsmail@sayegh.de>) |
Список | pgsql-bugs |
On 8 May 2001, Nabil Sayegh wrote: > On 08 May 2001 10:31:17 -0400, Vince Vielhaber wrote: > > > http://hermes.swu.bg/postgres/postgres/sql-altertable.htm > > > The correct syntax is: > > > ALTER TABLE foobar add column address varchar(50); > > > ALTER TABLE foobar alter column address set default 'none'; > > > > If this: > > > > alter table foobar add column address varchar(50) default 'none'; > > > > is the incorrect syntax, why does it not fail or at least give a > > warning? > > > > Sorry, I meant: Try this workaround :) Ok, now I'm officially confused :) Is it a bug that there's no error or warning or is it a bug that it ignores the default? Ok, I just found it: --- In the current implementation, default and constraint clauses for the new column will be ignored. You can use the SET DEFAULT form of ALTER TABLE to set the default later. (You will also have to update the already existing rows to the new default value, using UPDATE.) --- Thanks! Vince. -- ========================================================================== Vince Vielhaber -- KA8CSH email: vev@michvhf.com http://www.pop4.net 56K Nationwide Dialup from $16.00/mo at Pop4 Networking Online Campground Directory http://www.camping-usa.com Online Giftshop Superstore http://www.cloudninegifts.com ==========================================================================
В списке pgsql-bugs по дате отправления: