Skip site navigation (1) Skip section navigation (2)

Re: lo_manage trigger on updates

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>,pgsql-docs <pgsql-docs(at)postgresql(dot)org>
Subject: Re: lo_manage trigger on updates
Date: 2012-08-15 03:25:49
Message-ID: 20120815032549.GD25473@momjian.us (view raw or flat)
Thread:
Lists: pgsql-docs
On Tue, Oct 11, 2011 at 08:08:32PM -0400, Josh Kupershmidt wrote:
> On Mon, Oct 10, 2011 at 1:18 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> > On Thu, Aug 11, 2011 at 11:43 PM, Josh Kupershmidt <schmiddy(at)gmail(dot)com> 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  <bruce(at)momjian(dot)us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

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


In response to

pgsql-docs by date

Next:From: Tom LaneDate: 2012-08-15 04:21:50
Subject: Re: Would like to contribute a section to docs for 9.3. Where to start?
Previous:From: Bruce MomjianDate: 2012-08-15 03:22:20
Subject: Re: lo_manage trigger on updates

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group