Skip site navigation (1) Skip section navigation (2)

Re: [BUGS] Running queries on inherited tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Richards <miker(at)scifair(dot)acadiau(dot)ca>
Cc: pgsql-sql(at)postgreSQL(dot)org, pgsql-bugs(at)postgreSQL(dot)org
Subject: Re: [BUGS] Running queries on inherited tables
Date: 1999-09-13 00:00:10
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugspgsql-sql
Michael Richards <miker(at)scifair(dot)acadiau(dot)ca> writes:
> On Sun, 12 Sep 1999, Tom Lane wrote:
>> You have to say "alter table cities*", I believe, otherwise only cities
>> is changed.  Which is pretty broken --- if inheritance means anything,
>> then it ought to mean that the alteration is *inherently* applied to all
>> the child tables too, and you shouldn't have the option.

> Would this be a simple change in parsing the statement to see if it has
> any children and translate the statement accordingly?

Yes, I think it would be a reasonably localized change, assuming that
no one objected.  (I suppose somewhere out there is someone who thinks
the current behavior is a good idea ;-).)

>> (mostly from Chris Bitmead, I think).  ALTER TABLE really needs a
>> reimplementation from the ground up, but I dunno when anyone will get

> Considering how often Alter table is used, would it be reasonable to rip
> out all the alter table code and just have it do a select into;drop;rename

That would be a good route to a reimplementation, actually.  Want to
have a go at it?

> Of course I wouldn't want to do this on a 5Gb table...

There's probably not much choice.  The current implementation avoids
touching the data at all, but that is precisely the source of most of
its bugs and limitations.  I think most of the cases that we currently
can't handle would involve changing all the tuples, and at that point
select-into-a-new-table is probably really the preferred technique
compared to trying to do it in-place.  (In-place, you'd have to do a
VACUUM to get back the extra 5Gb after the transformation is done,
since you surely don't want to overwrite the old tuples before commit.)

			regards, tom lane


pgsql-bugs by date

Next:From: SueDate: 1999-09-13 13:42:13
Subject: Bug report?
Previous:From: Michael RichardsDate: 1999-09-12 18:41:48
Subject: Re: [BUGS] Running queries on inherited tables

pgsql-sql by date

Next:From: Ansley, MichaelDate: 1999-09-13 12:56:40
Subject: RE: [INTERFACES] ecpg and getting just assigned serial number
Previous:From: Michael RichardsDate: 1999-09-12 18:41:48
Subject: Re: [BUGS] Running queries on inherited tables

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group