Re: effective SELECT from child tables

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

Greg Stark <gsstark(at)mit(dot)edu> writes:
> It would be nice to be able to do:
> ALTER TABLE ADD foo integer DEFAULT 1
> And there's no question of what what the semantics of this are.

Sure, but you can only optimize this if the default expression is
immutable...

> On the other hand if you do
> ALTER TABLE ADD foo integer
> and then later do
> ALTER TABLE ALTER foo SET DEFAULT 1
> then there is a window where all those foos are NULL and then they magically
> become 1? That doesn't seem tenable.

It'd also be contrary to the SQL spec, AFAICS.

Here's another interesting case to think about:

ALTER TABLE ADD foo integer DEFAULT 1
...
ALTER TABLE ALTER foo SET DEFAULT 2

You'll have to pay the table-traversal cost on one step or the other.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-10-03 03:51:53 Re: pg_dump versioning
Previous Message Bruce Momjian 2005-10-03 02:54:10 Re: Updated documentation for new sequence binding