Re: [TRIGGER] Returning values from BEFORE UPDATE trigger, without using them - Mailing list pgsql-sql

From Torsten Zühlsdorff
Subject Re: [TRIGGER] Returning values from BEFORE UPDATE trigger, without using them
Date
Msg-id i2ojle$kcd$1@news.eternal-september.org
Whole thread Raw
In response to Re: [TRIGGER] Returning values from BEFORE UPDATE trigger, without using them  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Tom Lane schrieb:
> Torsten Zühlsdorff <foo@meisterderspiele.de> writes:
>> 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.
> 
> Why in the world would you do that?  Just return the modified row from
> the trigger and let the update proceed normally.

Because of content-revision. I have a lot of text which is modified and 
created from multiple persons. The requierment is, that i need every 
version of every content (+ their meta-data).
And i don't need just a log, which lists the changes. The different 
revisions of *one* content are used at the *same* time at *different* 
parts of the website. Therefore i rewrite every UPDATE to an INSERT. And 
except of the missing returning everything works fine and fast. :)

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.


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: [TRIGGER] Returning values from BEFORE UPDATE trigger, without using them
Next
From: Wes James
Date:
Subject: how to escape _ in select