On Mon, Nov 29, 2021 at 2:10 AM Andy Fan <zhihui.fan1...@gmail.com> wrote: > 1. During the ExecutorRun & ExecutorEnd, the relcache will never by > invalidated, if not > the old relation->balabala will be lost. I assume this is correct since I > didn't see any places > where we handle such changes in Executor code.
It's not correct. We accept invalidation messages in a number of different code paths, including whenever we acquire a lock on a relation. That doesn't typically happen in the middle of a query, but that's just because most queries don't happen to do anything that would make it happen. They can, though. For example, the query can call a user-defined function that accesses a table not previously touched by the transaction. Or a built-in function that does the same thing, like table_to_xml(). -- Robert Haas EDB: http://www.enterprisedb.com