Re: global temporary tables - Mailing list pgsql-hackers

From Tom Lane
Subject Re: global temporary tables
Date
Msg-id 24898.1272079728@sss.pgh.pa.us
Whole thread Raw
In response to Re: global temporary tables  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: global temporary tables  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Fri, Apr 23, 2010 at 11:11 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I also kind of wonder what is supposed to happen if someone DROPs or
>> ALTERs the temp table definition ...

> ...not so much.  Here you REALLY want a DROP attempt to acquire an
> AccessExclusiveLock that will conflict with any outstanding
> AccessShareLocks.  Similarly, you're only going to be able to modify
> the schema for the relation if it's not otherwise in use.

I think you're presuming the answer to the question.  We could also view
the desired behavior as being that each session clones the temp table
definition at some instant (eg, first use).  The approach that you're
assuming seems fraught with large downsides: in particular, implementing
ALTER TABLE would be a mess.  The would-be alterer would need access to
the physical copies of all sessions, which throws out not only the
assumption that the relmapper entries can be private data, but all of
the access optimizations we currently have in the local buffer manager.
Not to mention the coding mess of having to repeat the ALTER operation
for each of N copies, some of which might disappear while we're trying
to do it (or if they don't, we're blocking backends from exiting).
I don't even know how you'd do the ALTER over again N times if you
only have one set of catalog entries describing the N copies.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: global temporary tables
Next
From: Rod Taylor
Date:
Subject: CIText and pattern_ops