Re: Creation of temporary tables on read-only standby servers

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Martijn van Oosterhout <kleptog(at)svana(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org, Bruce Momjian <bruce(at)momjian(dot)us>
Subject: Re: Creation of temporary tables on read-only standby servers
Date: 2010-10-19 22:45:42
Message-ID: 10641.1287528342@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:
> On Tue, Oct 19, 2010 at 12:03 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> The trick is that it would require us to have two pg_class tables, two
>> pg_attribute tables, two pg_attrdef tables, etc.: in each case, one
>> permanent and one temporary. I am not sure how complex that will turn
>> out to be.

> Tom suggested using inheritance for this.

> I find it strange to try constructing catalog tables to represent
> these local definitions which never need to be read by any other
> backend and in any case are 1:1 copies of the global catalog entries.

> It seems to me simpler and more direct to just nail relcache
> entries for these objects into memory and manipulate them directly.

Relcache entries alone are not gonna work. There is way too much stuff
that assumes that tables are correctly represented in the system
catalogs.

It's possible that you could make it work if you created the child
catalogs and immediately filled them with suitable entries describing
the child catalogs themselves. Bootstrapping that might be a bit of fun
though.

The larger issue in all this is that there's so much code that supposes
that it just has to scan a particular catalog when it wants an entry,
and isn't going to go looking for child tables of the catalog. That's
possibly fixable but is not likely to be easy, unless you can somehow
hide it within systable_beginscan and related routines.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-10-19 22:51:45 Re: patch: Add JSON datatype to PostgreSQL (GSoC, WIP)
Previous Message Kevin Grittner 2010-10-19 22:28:30 Re: Serializable snapshot isolation patch