Re: effective SELECT from child tables

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Hannu Krosing <hannu(at)skype(dot)net>, Greg Stark <gsstark(at)mit(dot)edu>, Simon Riggs <simon(at)2ndquadrant(dot)com>, "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>, pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: effective SELECT from child tables
Date: 2005-10-02 15:43:46
Message-ID: 87vf0fc4b1.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Martijn van Oosterhout <kleptog(at)svana(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message mark 2005-10-02 18:25:53 Re: effective SELECT from child tables
Previous Message Martijn van Oosterhout 2005-10-02 15:12:23 Re: Socket problem using beta2 on Windows-XP