Jeff Davis <pg...@j-davis.com> writes:
> On Fri, 2012-12-14 at 17:56 -0500, Tom Lane wrote:
>> Perhaps a better idea is to not overload rd_backend to serve both
>> the "physical name of file" purpose and the "is it my temp table"
>> purpose.  We could add an additional relcache field with the
>> three possible states "not temp, my temp, somebody else's temp"
>> and make sure that the third state gets selected when there's
>> a chance collision like this.  Or resurrect the old rd_istemp and
>> rd_islocaltemp flags.

> Rather than bring back that flag, can we just use isTempOrToastNamespace
> within RELATION_IS_OTHER_TEMP?

>   #define RELATION_IS_OTHER_TEMP(relation) \
>       ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP \
>       && !isTempOrToastNamespace((relation)->rd_rel->relnamespace))

Meh.  I think this would work, but we would also have to change
RELATION_IS_LOCAL to use isTempOrToastNamespace similarly.  While
RELATION_IS_OTHER_TEMP doesn't seem to be used in any
performance-critical places (since it's generally checked no more than
once per command), I'm less willing to assume that it's okay to add
cycles to RELATION_IS_LOCAL.

On the whole I think resurrecting the rd_islocaltemp flag might be the
best thing.  We can keep the use of "relpersistence ==
RELPERSISTENCE_TEMP" to do what rd_istemp used to do, it's just the
equation of "rd_backend == MyBackendId" with "is my temp table" that's
bogus.  And this way gets rid of some unnecessary cross-branch coding
differences.

                        regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to