Re: Happy column adding (was RE: [HACKERS] Happy column dropping)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, "PostgreSQL Development" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: Happy column adding (was RE: [HACKERS] Happy column dropping)
Date: 2000-01-25 17:23:15
Message-ID: 14033.948820995@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp> writes:
>>>> Even default is not allowed in ADD COLUMN now.
>>
>> It's not a matter of *allowed*, it's a parsing deficiency. The fact that
>> there was a default declared gets silently ignored.

> IIRC,there were some reason that default for new column had been rejected.

Well, yeah: wouldn't you expect that "ADD COLUMN x DEFAULT 42" would
cause every row currently existing in the table to acquire x = 42,
rather than x = NULL? In fact that would *have* to happen to allow
constraints to be added; consider ADD COLUMN x DEFAULT 42 NOT NULL.

The only way to make that happen is for ADD COLUMN to switch over to
an implementation that rewrites all the tuples. Which I think is the
right way to go ... but per this discussion, it's not a trivial fix.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-01-25 17:39:25 Re: Happy column adding (was RE: [HACKERS] Happy column dropping)
Previous Message Tom Lane 2000-01-25 17:16:46 Re: [SQL] DISTINCT ON: speak now or forever hold your peace