Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 6AE9D632CDB for ; Fri, 23 Jul 2010 09:55:24 -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 01679-08 for ; Fri, 23 Jul 2010 12:55:17 +0000 (UTC) Received: from news.hub.org (news.hub.org [200.46.204.72]) by mail.postgresql.org (Postfix) with ESMTP id 5210D632725 for ; Fri, 23 Jul 2010 09:55:17 -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 o6NCtB3q014388 for ; Fri, 23 Jul 2010 09:55:11 -0300 (ADT) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.4/8.14.4/Submit) id o6NCr9IU008131 for pgsql-sql@postgresql.org; Fri, 23 Jul 2010 09:53:09 -0300 (ADT) (envelope-from news) From: =?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= X-Newsgroups: pgsql.sql Subject: [TRIGGER] Returning values from BEFORE UPDATE trigger, without using them Date: Fri, 23 Jul 2010 14:53:11 +0200 Organization: A noiseless patient Spider Lines: 23 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 23 Jul 2010 12:53:13 +0000 (UTC) Injection-Info: mx03.eternal-september.org; posting-host="AnkPUomeHXvuN7UdHvIkog"; logging-data="31861"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19uKeKL23jsyGkUnP/P+rWY" 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 Cancel-Lock: sha1:NX5ARWvlXspv696UzOeh5Rw12hg= 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/99 X-Sequence-Number: 34412 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.