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: Re: [TRIGGER] Returning values from BEFORE UPDATE trigger, without using them
Date: Wed, 28 Jul 2010 08:45:02 +0200
Message-ID: <i2ojle$kcd$1@news.eternal-september.org> (raw)
In-Reply-To: <13845.1280263824@sss.pgh.pa.us>
References: <i2c3bp$v3l$1@news.eternal-september.org>
	<13845.1280263824@sss.pgh.pa.us>

Tom Lane schrieb:
> =?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= <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.



view thread (4+ messages)

Message-ID: <i2ojle$kcd$1@news.eternal-september.org>
Permalink:  ../i2ojle$kcd$1@news.eternal-september.org/
Also on:    postgresql.org/message-id/i2ojle$kcd$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: <i2ojle$kcd$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