Re: feature request - adding columns with default value - Mailing list pgsql-general

From Stephan Szabo
Subject Re: feature request - adding columns with default value
Date
Msg-id 20030404093920.T94635-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Re: feature request - adding columns with default value  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Fri, 4 Apr 2003, Tom Lane wrote:

> Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> > SET DEFAULT just sets the default up but also doesn't modify the actual rows
> > stored on disk.  Presumably SET DEFAULT should probably do the update,
>
> No, it shouldn't; the existing behavior is per spec.  SET DEFAULT just
> changes the default for future insertions, it's not supposed to touch
> the present table contents.

Yeah, realized that didn't make much sense afterwards.

> ALTER TABLE ADD COLUMN with a default clause *is* supposed to fill all
> rows of the table with the default.  The reason we reject it is we don't
> have that behavior implemented.

Right.  We should probably change the error text then since it doesn't
actually mention the update being necessary (and what it suggests is just
as wrong as the behavior it would have if we just did the default in one
step).


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: heap_mark4update error on UPDATE
Next
From: Dennis Gearon
Date:
Subject: before and after triggers