Re: Triggers with DO functionality

From: Thom Brown <thom(at)linux(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Jaime Casanova <jaime(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Triggers with DO functionality
Date: 2014-09-16 12:54:49
Message-ID: CAA-aLv4HnOVvR+r1dQFPbbCa3=fDgyq45OKRbDp_Lxdeofte7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16 September 2014 13:45, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:

> On 2014-09-16 13:42:22 +0100, Thom Brown wrote:
> > > > The function can't be the target of CREATE OR REPLACE FUNCTION.
> > >
> > > That *really* sucks. To the point of making the feature useless in my
> > > eyes. That's really something frequently done.
> > >
> >
> > Why not CREATE OR REPLACE TRIGGER? Wouldn't the function itself be an
> > internal matter rather than something for users to worry about? If the
> > user needs to adjust it, they'd need to discover the name of the function
> > the trigger referred to, which may not be trivial.
>
> Because CREATE OR REPLACE trigger has to take a heavy relation level
> lock? Because we don't have it? Because it'll allow to change things
> that you really don't want to change?

Would CREATE OR REPLACE trigger need a heavy relational level lock if just
the anonymous function body were changing?

My concern is mainly about us on one hand saying "Look, we've removed the
need for trigger statements when creating triggers", then on the other
saying "But if you want to change anything, treat it as if we hadn't done
that, and you'll need to go find the function that we made in the
background."

I guess if we were to do that, we would just need to make it clear that
this is all syntactic sugar, and things like \d+ <table> output would show
the trigger calling the "anonymous" function rather than showing the body
of the function as part of the trigger.

--
Thom

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-09-16 12:58:19 Re: Triggers with DO functionality
Previous Message Andres Freund 2014-09-16 12:45:37 Re: Triggers with DO functionality