pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
obtaining the query string inside a trigger
2+ messages / 2 participants
[nested] [flat]

* obtaining the query string inside a trigger
@ 2008-01-15 21:29 Gerardo Herzig <gherzig@fmed.uba.ar>
  2008-01-16 09:21 ` Re: obtaining the query string inside a trigger Richard Huxton <dev@archonet.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Gerardo Herzig @ 2008-01-15 21:29 UTC (permalink / raw)
  To: pgsql-sql

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?

Thanks!
Gerardo



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: obtaining the query string inside a trigger
  2008-01-15 21:29 obtaining the query string inside a trigger Gerardo Herzig <gherzig@fmed.uba.ar>
@ 2008-01-16 09:21 ` Richard Huxton <dev@archonet.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Richard Huxton @ 2008-01-16 09:21 UTC (permalink / raw)
  To: Gerardo Herzig <gherzig@fmed.uba.ar>; +Cc: pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2008-01-16 09:21 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-01-15 21:29 obtaining the query string inside a trigger Gerardo Herzig <gherzig@fmed.uba.ar>
2008-01-16 09:21 ` Richard Huxton <dev@archonet.com>

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