public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bruce Momjian <[email protected]>
To: Josh Kupershmidt <[email protected]>
Cc: Robert Haas <[email protected]>
Cc: pgsql-docs <[email protected]>
Subject: Re: lo_manage trigger on updates
Date: Tue, 14 Aug 2012 23:25:49 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAK3UJREFBuXJfb3OqUyU+Q_Rm82Xnjyxf7_wJqzQgu+ozDBAoQ@mail.gmail.com>
References: <CAK3UJRHaEuzfnZaxarcV8=RP1sC5xLxumzqx6iiyqpJVS89rjw@mail.gmail.com>
	<CA+TgmoZQEbFFRR9X25azdBMpWcYx6RDncTODF0hOcR9GYRz0dw@mail.gmail.com>
	<CAK3UJREFBuXJfb3OqUyU+Q_Rm82Xnjyxf7_wJqzQgu+ozDBAoQ@mail.gmail.com>

On Tue, Oct 11, 2011 at 08:08:32PM -0400, Josh Kupershmidt wrote:
> On Mon, Oct 10, 2011 at 1:18 PM, Robert Haas <[email protected]> wrote:
> > On Thu, Aug 11, 2011 at 11:43 PM, Josh Kupershmidt <[email protected]> wrote:
> >> I think the doc section about using lo_manage() as a trigger:
> >>   http://www.postgresql.org/docs/current/static/lo.html
> >>
> >> could have its example tweaked to use a column-level BEFORE UPDATE
> >> trigger, so as to save unnecessary trigger firings. Something like the
> >> attached, perhaps?
> >
> > Uh, wow.  That syntax is horribly surprising, isn't it?  My eyes want
> > to parse it as:
> >
> > BEFORE (UPDATE OF raster) OR (DELETE ON image)
> >
> > ...which is totally wrong.
> 
> Yeah, the syntax we have is really confusing. I notice this tidbit on that page:
> 
> | The ability to specify multiple actions for a single trigger using OR
> | is a PostgreSQL extension of the SQL standard.
> 
> Maybe the folks dreaming up the SQL standard are sharper than they get
> credit for.
> 
> > I'm inclined to think that maybe we should leave that example as-is,
> > and maybe add the variant you're proposing as a second example,
> > showing how the basic version can be refined.
> 
> The nice thing about keeping the example the way it is, is that it's
> pretty simple to understand, and maybe adding the second slightly more
> complicated example would just confuse things. We could just add in a
> blurb like this at the end of "How to Use It":
> 
>    You may wish to restrict the trigger
>     to only fire upon UPDATEs of the <type>lo</> column(s) in the table by
>     specifying the column name via BEFORE UPDATE OF
>     <replaceable class="parameter">column_name</replaceable>.

I think I like that idea so I used your text instead of the full
new example.

-- 
  Bruce Momjian  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +





view thread (5+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: lo_manage trigger on updates
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox