Hi Aleksander,
Thank you for your answers. It seems, local buffers are used for temporary relations unconditionally. In this case, we may check either relpersistence or backend id, or both of them.
I didn't do a deep investigation of the code in this particular aspect but that could be a fair point. Would you like to propose a refactoring that unifies the way we check if the relation is temporary?
I would propose not to associate temporary relations with local buffers. I would say, that we that we should choose local buffers only in a backend context. It is the primary condition. Thus, to choose local buffers, two checks should be succeeded:
- relpersistence (RelationUsesLocalBuffers)
- backend id (SmgrIsTemp)
I know, it may be not as effective as to check relpersistence only, but it makes the internal architecture more flexible, I believe.
With best regards,
Vitaly Davydov