Tables cannot have INSTEAD OF triggers

Поиск
Список
Период
Сортировка
Искать

Tables cannot have INSTEAD OF triggers

От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
Why not?  Is there a fundamental problem, or just that no one wanted to
make it work?



Re: Tables cannot have INSTEAD OF triggers

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Peter Eisentraut  writes:
> Why not?  Is there a fundamental problem, or just that no one wanted to
> make it work?

I'm fairly sure there was a substantive issue, but memory fails as to
what it was.  You could try removing the error check and see what
breaks ...
		regards, tom lane

Re: Tables cannot have INSTEAD OF triggers

От:
Dean Rasheed <dean.a.rasheed@gmail.com>
Дата:
On 11 May 2011 19:51, Tom Lane  wrote:
> Peter Eisentraut  writes:
>> Why not?  Is there a fundamental problem, or just that no one wanted to
>> make it work?
>

More the latter really. I think they're very useful on views, but I
couldn't think of a use-case for having them on tables. ISTM that
anything an INSTEAD OF trigger on a table could do, could equally well
be done in a BEFORE trigger.

(BTW, the current behaviour is per SQL spec.)


> I'm fairly sure there was a substantive issue, but memory fails as to
> what it was.  You could try removing the error check and see what
> breaks ...
>

The first thing that would break is the Assert that checks oldtuple
(for UPDATE/DELETE), since the 'wholerow' attribute that INSTEAD OF
triggers rely on isn't built for a table. This is probably fixable,
I'm just not convinced that it's worth it.

If we did support INSTEAD OF triggers on tables, we would also need to
decide how they interact with BEFORE/AFTER triggers - do they fire in
between them, or do they replace them? I could see arguments for
either behaviour.

Regards,
Dean

FAQ