Bruce Momjian <maillist@candle.pha.pa.us> writes:
> Well, I now wonder whether I did the right thing in adding temp tables
> the way I did. Is there a better way.
I don't think there's anything wrong with the basic temp table design.
We've just discovered an oversight: given a Relation entry, there's no
way to get back the original table name, and sometimes you need to.
I'm inclined to think that RelationGetRelationName should be replaced
by two access macros: one to give back the "physical" rel name (same
as the current macro) and one to give back the "logical" name, which'd
be different in the case of a temp table. We'd need to extend relcache
entries to include the logical name as an additional field. Then we'd
need to look at all the uses of RelationGetRelationName to see which
ones should be which. There might be some direct accesses to
rel->rd_rel->relname as well :-( which need to be found and fixed.
regards, tom lane