Re: Tables cannot have INSTEAD OF triggers - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: Tables cannot have INSTEAD OF triggers
Date
Msg-id BANLkTi=A9b8Jkn7YDXqu5oY9eQnr8O8AaQ@mail.gmail.com
Whole thread Raw
In response to Re: Tables cannot have INSTEAD OF triggers  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 11 May 2011 19:51, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Peter Eisentraut <peter_e@gmx.net> 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


pgsql-hackers by date:

Previous
From: Dimitri Fontaine
Date:
Subject: Re: Extension Packaging
Next
From: "Albe Laurenz"
Date:
Subject: Re: Fix for bug in ldapServiceLookup in libpq