PL/pgSQL return value in after triggers - Mailing list pgsql-hackers

From Peter Eisentraut
Subject PL/pgSQL return value in after triggers
Date
Msg-id 1298912836.26119.9.camel@vanquo.pezone.net
Whole thread Raw
Responses Re: PL/pgSQL return value in after triggers  (Robert Haas <robertmhaas@gmail.com>)
Re: PL/pgSQL return value in after triggers  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: PL/pgSQL return value in after triggers  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
PL/pgSQL trigger functions currently require a value to be returned,
even though that value is not used for anything in case of a trigger
fired AFTER.  I was wondering if we could relax that.  It would make
things a bit more robust and produce clearer PL/pgSQL code.  The
specific case I'm concerned about is that a trigger function could
accidentally be run in a BEFORE trigger even though it was not meant for
that.  It is common practice that trigger functions for AFTER triggers
return NULL, which would have unpleasant effects if used in a BEFORE
trigger.

I think it is very uncommon to have the same function usable for BEFORE
and AFTER triggers, so it would be valuable to have coding support
specifically for AFTER triggers.  We could just allow RETURN without
argument, or perhaps no RETURN at all.

Comments?




pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: knngist - 0.8
Next
From: Tom Lane
Date:
Subject: Re: pl/python custom exceptions for SPI