| От | Tom Lane |
|---|---|
| Тема | Re: deleting from a view |
| Дата | |
| Msg-id | 2947.971826212@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | deleting from a view (shawn everett <everett@pgweb.com>) |
| Список | pgsql-general |
shawn everett <everett@pgweb.com> writes:
> Should I use a trigger or a rule? If I use a trigger how should it be
> written. If I use a rule how do I put two delete statements in it.
You can't use a trigger, because a trigger is fired at the point where
a physical tuple is about to be inserted/deleted/updated. The view has
no physical tuples, therefore nothing to fire a trigger on.
The problem with the rule, as you guessed, is that once you delete from
the first table there are no longer any matching tuples in the view
(which is what OLD is referring to), so second delete doesn't find any
matches. Perhaps Jan Wieck can think of a solution ... I'm not sure
how to do it.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера