Re: WIP: Triggers on VIEWs

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: WIP: Triggers on VIEWs
Дата
Msg-id 7529.1286557416@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: WIP: Triggers on VIEWs  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Ответы Re: WIP: Triggers on VIEWs  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> On 8 October 2010 16:50, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I've started looking at this patch now. �I think it would have been best
>> submitted as two patches: one to add the SQL-spec "INSTEAD OF" trigger
>> functionality, and a follow-on to extend INSTEAD OF triggers to views.

> SQL-spec "INSTEAD OF" triggers *are* view triggers. I don't see how
> you can separate the two.

Oh, they're not allowed on tables?  Why not?  AFAICS they'd be exactly
equivalent to a BEFORE trigger that always returns NULL.

> I think that you're confusing 2 different parts of code here. The
> TRIGGER_FIRED_AFTER/TRIGGER_FIRED_BEFORE macros operate on the bits
> from the tg_event field of the TriggerData structure.

Yeah, I'm aware of that.  My point is that all code that deals with
trigger firing times now has to consider three possible states where
before there were two; and it's entirely likely that some places are
testing for the wrong condition once a third state is admitted as a
possibility.

> The scope for user
> code being broken is limited beause they'd have to put one of these
> trigger functions in an INSTEAD OF trigger on a view.

Well, the only reason those tests are being made at all is as
self-defense against being called via an incorrect trigger definition.
So they're worth nothing if they fail to treat the INSTEAD OF case
correctly.
        regards, tom lane


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

Предыдущее
От: Dean Rasheed
Дата:
Сообщение: Re: WIP: Triggers on VIEWs
Следующее
От: Robert Haas
Дата:
Сообщение: Re: GIN vs. Partial Indexes