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

From Bruce Momjian
Subject Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected results
Date
Msg-id 200111280544.fAS5i5c20466@candle.pha.pa.us
Whole thread Raw
In response to ALTER TABLE ADD COLUMN column SERIAL -- unexpected results  ("Rod Taylor" <rbt@barchord.com>)
Responses Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected
List pgsql-hackers
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > So, are we now all agreed that we have to fill in the existing rows with
> > the default value?
> 
> I think there's no debate that that's what the spec says to do.  There
> might be some discontent in the ranks about whether to follow SQL92's
> marching orders, however.  Doubling the filesize of the table to apply
> changes that the user might not even want seems a heavy penalty.
> 
> > If so, I can document that in the TODO list and
> > discard this patch.
> 
> This is certainly a TODO or TOARGUEABOUT item, not something to be
> patched on short notice.

Agreed.  I didn't think it was going into 7.2 anyway.  I am just looking
to see if we will solve this with code or we will solve it with
documentation.  If it was documentation, I was going to see if I could
come up with some wording.

However, because the spec is clear, seems we will have to do some
codework on this later.  Added to TODO:
       o ALTER TABLE ADD COLUMN column SET DEFAULT should fill existing         rows with DEFAULT value or allow NULLs
inexisting rows
 

My guess is that we will have to do spec behavior by default, and add a
flag to allow NULLs in existing rows.

Yuck, but at least we have a direction.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected results
Next
From: Tom Lane
Date:
Subject: Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected results