Re: Tables cannot have INSTEAD OF triggers

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Aliouii Ali <aliouii(dot)ali(at)aol(dot)fr>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Tables cannot have INSTEAD OF triggers
Date: 2015-04-01 15:40:13
Message-ID: CA+TgmoaF24Y3Q_x_+F=h_aJaBsO8PmnB0aBgKUivA+C7_c+0FA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 31, 2015 at 8:49 AM, Aliouii Ali <aliouii(dot)ali(at)aol(dot)fr> wrote:
> hi all,
> back in
> 2011(http://www.postgresql.org/message-id/1305138588.8811.3.camel@vanquo.pezone.net),
> an question the same as this one was asked
> the anwser was :
>
> 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.
> no not really there is a use-case : in partitioned table ( instead of
> defining before trigger on the master table that return null as the doc
> states, it will be good things to have instead of trigger that return NEW)
> so that query like insert/update ... .. RETURNING will be handdy and gain
> some performance, otherwise we will have to do an insert and select to get
> the same jobs done

I don't see how this helps. The problem with partitioning is that you
need a way to redirect the INSERT to another table, and there's no
built-in way to do that, so you have to simulate it somehow. That
issue seems largely separate from how the CREATE TRIGGER command is
spelled. Maybe I'm missing something.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2015-04-01 15:40:27 Re: Bug fix for missing years in make_date()
Previous Message Robert Haas 2015-04-01 15:28:21 Re: Combining Aggregates