pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Gerardo Herzig <gherzig@fmed.uba.ar>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: obtaining the query string inside a trigger
Date: Wed, 16 Jan 2008 09:21:37 +0000
Message-ID: <478DCCA1.4060505@archonet.com> (raw)
In-Reply-To: <478D25B7.8030308@fmed.uba.ar>
References: <478D25B7.8030308@fmed.uba.ar>

Gerardo Herzig wrote:
> Hi all. Im working on a "on each statement" update trigger, so NEW and 
> OLD are NULL.
> Suppose a simple query like 'update mytable set id=id+500 where id < 
> 50'...There is a way to obtaining the 'set id=..' and the where clause
> in some way?

Afraid not. It might be possible to implement in the simple case, but 
what with views rewriting queries and triggers issuing their own 
secondary queries it's not always obvious what "the" query would be.

What we really need is NEW and OLD as sets of affected rows in 
statement-queries. Unfortunately that's not implemented yet either - 
it's on the TODO I believe though.

-- 
   Richard Huxton
   Archonet Ltd



view thread (2+ messages)

Message-ID: <478DCCA1.4060505@archonet.com>
Permalink:  ../478DCCA1.4060505@archonet.com/
Also on:    postgresql.org/message-id/478DCCA1.4060505@archonet.com

 · 

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: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, gherzig@fmed.uba.ar
  Subject: Re: obtaining the query string inside a trigger
  In-Reply-To: <478DCCA1.4060505@archonet.com>

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

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