Folks,

Pardon me if this has already been discussed and rejected for good reason.   

Now that we have Statement-level triggers, is there any reason we shouldn't 
have triggers on SELECT?   Such triggers could be extremely useful for 
databases with tight security audit requirements.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco


Tue, 7 Oct 2003 12:42:23 -0700
Josh Berkus <josh@agliodbs.com>
Triggers on SELECT?
Josh Berkus <josh@agliodbs.com> writes:
> Now that we have Statement-level triggers, is there any reason we shouldn't 
> have triggers on SELECT?

Plenty, although I'm too tired to recall 'em all.  The fundamental
problem with this is that it turns SELECT into an operation with
side-effects.

			regards, tom lane

Tue, 07 Oct 2003 23:21:21 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Triggers on SELECT? 
Tom Lane wrote:

> Josh Berkus <josh@agliodbs.com> writes:
>> Now that we have Statement-level triggers, is there any reason we shouldn't 
>> have triggers on SELECT?
> 
> Plenty, although I'm too tired to recall 'em all.  The fundamental
> problem with this is that it turns SELECT into an operation with
> side-effects.

The other fundamental problem is the definition of SELECT. To show just 
one of the 273 possible problems:

     UPDATE sometab SET foo = 'bar'
         WHERE NOT EXISTS (SELECT 1 FROM othertab WHERE o_id = s_id);

Now explain in detail what the ON SELECT trigger on othertab will be 
fired for.


Jan

-- 
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #


Thu, 09 Oct 2003 15:08:39 -0400
Jan Wieck <JanWieck@Yahoo.com>
Re: Triggers on SELECT?