Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected
Date
Msg-id Pine.LNX.4.30.0111281502350.636-100000@peter.localdomain
Whole thread Raw
In response to Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected results  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected
List pgsql-hackers
Bruce Momjian writes:

>         o ALTER TABLE ADD COLUMN column SET DEFAULT should fill existing
>           rows with DEFAULT value or allow NULLs in existing rows
>
> My guess is that we will have to do spec behavior by default, and add a
> flag to allow NULLs in existing rows.

May I point you to the already existing set of commands that do exactly
what you want:

ALTER TABLE t1 ADD COLUMN name type;
ALTER TABLE t1 ALTER COLUMN name SET DEFAULT foo;

There's no reason to muck around with the spec here.

-- 
Peter Eisentraut   peter_e@gmx.net



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: FW: [ppa-dev] Severe bug in debian - phppgadmin opens
Next
From: Peter Eisentraut
Date:
Subject: Re: CVS branch management (was Re: A problem with new