From: | Torsten Zühlsdorff <foo(at)meisterderspiele(dot)de> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: [TRIGGER] Returning values from BEFORE UPDATE trigger, without using them |
Date: | 2010-07-28 06:45:02 |
Message-ID: | i2ojle$kcd$1@news.eternal-september.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Tom Lane schrieb:
> =?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= <foo(at)meisterderspiele(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Wes James | 2010-07-28 17:35:18 | how to escape _ in select |
Previous Message | Tom Lane | 2010-07-27 20:50:24 | Re: [TRIGGER] Returning values from BEFORE UPDATE trigger, without using them |