On Tue, Mar 31, 2015 at 8:49 AM, Aliouii Ali <aliouii.ali@aol.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