Re: Trigger questions

Поиск
Список
Период
Сортировка
От Justin
Тема Re: Trigger questions
Дата
Msg-id CALL-XeNf3R2yukc4UxNrjpCyvV1x6CEdbe7q=Ww3ahh9N4Ya8g@mail.gmail.com
обсуждение исходный текст
Ответ на Trigger questions  (DAVID ROTH <adaptron@comcast.net>)
Ответы Re: Trigger questions
Re: Trigger questions
Список pgsql-general


On Thu, May 4, 2023 at 9:49 AM DAVID ROTH <adaptron@comcast.net> wrote:
1) Can I create a trigger on a view?
2) Do triggers cascade?

Say I have an insert trigger on a table.
And, I have an insert trigger on a view that references this table
If I do an insert on the view, will both triggers fire?

Can not have triggers on Views,  Views use  RULES  which are DO INSTEAD.
https://www.postgresql.org/docs/current/rules.html

Yes if you have an INSERT/UPDATE/DELETE rule on a view  that inserts into a table then that table's triggers will be executed. 

Please note RULES should  be avoided beyond the use case for VIEWS.  RULES are executed very early in the query tree; it is not trivial to write rules on Tables.

Thanks

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

Предыдущее
От: DAVID ROTH
Дата:
Сообщение: Trigger questions
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Trigger questions