Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected results

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Rod Taylor <rbt(at)barchord(dot)com>, Hackers List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected results
Date: 2001-11-28 05:44:05
Message-ID: 200111280544.fAS5i5c20466@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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 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.

Yuck, but at least we have a direction.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2001-11-28 06:03:29 Re: Call for platform testing
Previous Message Tom Lane 2001-11-28 05:36:20 Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected results