Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 2C98B6323CD for ; Wed, 28 Jul 2010 03:56:30 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 28123-01 for ; Wed, 28 Jul 2010 06:56:22 +0000 (UTC) Received: from news.hub.org (news.hub.org [200.46.204.72]) by mail.postgresql.org (Postfix) with ESMTP id C010E6322E8 for ; Wed, 28 Jul 2010 03:56:22 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.4/8.14.4) with ESMTP id o6S6uHHD070417 for ; Wed, 28 Jul 2010 03:56:20 -0300 (ADT) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.4/8.14.4/Submit) id o6S6j3oH038016 for pgsql-sql@postgresql.org; Wed, 28 Jul 2010 03:45:03 -0300 (ADT) (envelope-from news) From: =?UTF-8?B?VG9yc3RlbiBaw7xobHNkb3JmZg==?= X-Newsgroups: pgsql.sql Subject: Re: [TRIGGER] Returning values from BEFORE UPDATE trigger, without using them Date: Wed, 28 Jul 2010 08:45:02 +0200 Organization: A noiseless patient Spider Lines: 24 Message-ID: References: <13845.1280263824@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 28 Jul 2010 06:45:02 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="AnkPUomeHXvuN7UdHvIkog"; logging-data="20877"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18rODQqk2TfHkYDDCGcdlUz" User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 Mnenhy/0.7.5.0 In-Reply-To: <13845.1280263824@sss.pgh.pa.us> Cancel-Lock: sha1:4BG1E4/02zr+p4SsG3eTESBKO/Q= To: pgsql-sql@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.79 tagged_above=-5 required=5 tests=BAYES_50=0.8, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201007/108 X-Sequence-Number: 34421 Tom Lane schrieb: > =?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= 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.