Re: feature request - adding columns with default value

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Henrik Steffen <steffen(at)city-map(dot)de>, pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: feature request - adding columns with default value
Date: 2003-04-04 17:41:35
Message-ID: 20030404093920.T94635-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 4 Apr 2003, Tom Lane wrote:

> Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)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).

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dennis Gearon 2003-04-04 18:17:36 before and after triggers
Previous Message Tom Lane 2003-04-04 17:28:02 Re: heap_mark4update error on UPDATE