Re: Alter table add column ignores default - Mailing list pgsql-bugs

From Vince Vielhaber
Subject Re: Alter table add column ignores default
Date
Msg-id Pine.BSF.4.30.0105081115350.66156-100000@paprika.michvhf.com
Whole thread Raw
In response to Re: Alter table add column ignores default  (Nabil Sayegh <nsmail@sayegh.de>)
List 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 by date:

Previous
From: Palle Girgensohn
Date:
Subject: Re: freebsd sample startup script doesn't work
Next
From: Vince Vielhaber
Date:
Subject: Re: Alter table add column ignores default