Re: Tables cannot have INSTEAD OF triggers

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Tables cannot have INSTEAD OF triggers
Date: 2011-05-12 07:42:22
Message-ID: BANLkTi=A9b8Jkn7YDXqu5oY9eQnr8O8AaQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11 May 2011 19:51, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Albe Laurenz 2011-05-12 08:22:23 Re: Fix for bug in ldapServiceLookup in libpq
Previous Message Dimitri Fontaine 2011-05-12 07:29:26 Re: Extension Packaging