Greg Stark <gsstark@mit.edu> writes:
> On Tue, Oct 19, 2010 at 12:03 PM, Robert Haas <robertmhaas@gmail.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