pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Torsten Zühlsdorff <foo@meisterderspiele.de>
To: pgsql-sql@postgresql.org
Subject: [TRIGGER] Returning values from BEFORE UPDATE trigger, without using them
Date: Fri, 23 Jul 2010 14:53:11 +0200
Message-ID: <i2c3bp$v3l$1@news.eternal-september.org> (raw)

Hello,

i have a non-trival problem and i do not believe that it is solvable.

I have defined an BEFORE UPDATE trigger. The trigger catch every update, 
change some columns of the new row, make an insert of the new row and 
returns null to abort the update.
All fine till here :)

Now the problem: if i do an UPDATE table [..] RETURNING * it returns 
always null. This is correct behavior, because the UPDATE is canceld by 
the trigger which returns null, so the updated data is "null".
But i want to get the new data inserted by the trigger without a new 
select. Is there a possibility to get the inserted data or do i have to 
do a select after the update?

Greetings,
Torsten
-- 
http://www.dddbl.de - ein Datenbank-Layer, der die Arbeit mit 8 
verschiedenen Datenbanksystemen abstrahiert,
Queries von Applikationen trennt und automatisch die Query-Ergebnisse 
auswerten kann.



view thread (4+ messages)  latest in thread

Message-ID: <i2c3bp$v3l$1@news.eternal-september.org>
Permalink:  ../i2c3bp$v3l$1@news.eternal-september.org/
Also on:    postgresql.org/message-id/i2c3bp$v3l$1@news.eternal-september.org

 · 

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: foo@meisterderspiele.de
  Subject: Re: [TRIGGER] Returning values from BEFORE UPDATE trigger, without using them
  In-Reply-To: <i2c3bp$v3l$1@news.eternal-september.org>

* 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