Re: effective SELECT from child tables - Mailing list pgsql-hackers

From Greg Stark
Subject Re: effective SELECT from child tables
Date
Msg-id 87vf0fc4b1.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: effective SELECT from child tables  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
Martijn van Oosterhout <kleptog@svana.org> writes:

> However, from a semantic point of view, it would be a bit strange. If
> you added a column, updated some rows then set a default, that default
> might end up applying to every row, except the ones you already
> modified. With careful coding you may be able to get around this.

I suppose the update would have to check for these new columns and fill in the
default value when first updated.

But what do you do if the DEFAULT expression isn't immutable. Volatile DEFAULT
expressions are extremely common in databases... namely sequences.

It's too bad though. An efficient way to add a new column with a default would
clear up one of the missing feature of Postgres. Virtually every time I add a
new column I have to do this ALTER TABLE, ALTER COLUMN SET DEFAULT, UPDATE
TABLE, VACUUM FULL, ALTER COLUMN SET NOT NULL dance. It would be real nice if
you could add a new NOT NULL column with a default with a single command and
just move on.

-- 
greg



pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Socket problem using beta2 on Windows-XP
Next
From: Simon Riggs
Date:
Subject: Re: External Sort timing debug statements