Re: BUG #18763: pg_get_viewdef returns an old def with new relation name

Поиск
Список
Период
Сортировка
От lyz
Тема Re: BUG #18763: pg_get_viewdef returns an old def with new relation name
Дата
Msg-id CABRu854-EF3bgR-dAyapoyBz4m3sFvnT8Z_WY6RTARy-hjqFyg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #18763: pg_get_viewdef returns an old def with new relation name  (Kirill Reshke <reshkekirill@gmail.com>)
Список pgsql-bugs
It seems like an old, raw viewdef has already been obtained from pg_rewrite before it was blocked by first connection. 
Then in `get_query_def`, it tries to parse the raw viewdef. 
Before finishing its work, `get_query_def` will acquire locks and wait until first connection finishes. 
After that, during the parsing process, relation names are finally generated by `generate_relation_name` in ruleutils.c using `SearchSysCache1`.
And `SearchSysCache1` will use the catalog snapshot to get the latest relname. 
Perhaps we should refer to the code of `pg_get_constraintdef_worker`, directly using `systable_beginscan` with transaction snapshot?

Regards
Lin Yuzhe

В списке pgsql-bugs по дате отправления: