Re: deleting from a view

Поиск
Список
Период
Сортировка
От 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 по дате отправления:

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: deleting from a view
Следующее
От: Peter Mount
Дата:
Сообщение: Re: Error building JDBC Driver