Funny behavior in event trigger code with CREATE OR REPLACE VIEW and column additions
В списке pgsql-hackers по дате отправления:
| От | Michael Paquier |
|---|---|
| Тема | Funny behavior in event trigger code with CREATE OR REPLACE VIEW and column additions |
| Дата | |
| Msg-id | aaFG9bqkEn0RhLJG@paquier.xyz обсуждение исходный текст |
| Ответы |
Re: Funny behavior in event trigger code with CREATE OR REPLACE VIEW and column additions
|
| Список | pgsql-hackers |
Hi all, While removing some dust from my stack of patches, I have bumped into a weird interaction with CREATE OR REPLACE VIEW due to AT_AddColumnToView: CREATE VIEW one_view AS SELECT * FROM one; -- Adds some columns. CREATE OR REPLACE VIEW one_view AS SELECT * FROM one, two; The funny behavior is with the second VIEW query, that has the idea to stack twice a ViewStmt in event triggers: once in a EventTriggerCollectSimpleCommand() and a second time in EventTriggerAlterTableEnd(). Now, why would the second one be stacked? Well, EventTriggerAlterTableEnd() would add it because it has some AT_AddColumnToView subcommands. First, I was wondering if we should tweak EventTriggerAlterTableEnd() so as subcommands that add columns to a view should not be duplicated, applying some filtering. However, at the end, I have come to accept the fact that event triggers are a representation at SQL level of the internal structures of these commands. Hence, the current code is fine, still we had better have some tests to document that. And we don't do that now. This issue has come up while looking at a portion of my sequence AM patch, where I was not sure what the right representation should be in event triggers. I just noticed that column additions for views do already the same thing. So, please find attached a small-ish patch to close the gap with a few tests: - One thing for event_trigger.sql, with column additions for view, to check the collection. - One for test_ddl_deparse, that shows the stack of both a "simple" and an "alter table". Thoughts or comments? -- Michael
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера