Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 39FC6632EC0 for ; Tue, 11 May 2010 11:48:47 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 77770-04 for ; Tue, 11 May 2010 14:48:38 +0000 (UTC) X-Greylist: delayed 00:22:06.349815 by SQLgrey-1.7.6 Received: from wikingerlegenden.de (static.154.214.46.78.clients.your-server.de [78.46.214.154]) by mail.postgresql.org (Postfix) with ESMTP id D4394632C66 for ; Tue, 11 May 2010 11:48:39 -0300 (ADT) Received: from [192.168.23.242] (static.154.214.46.78.clients.your-server.de [78.46.214.154]) (authenticated bits=0) by wikingerlegenden.de (8.14.2/8.14.2) with ESMTP id o4BEQTPs016088 for ; Tue, 11 May 2010 16:26:30 +0200 (CEST) (envelope-from foo@meisterderspiele.de) Message-ID: <4BE96915.8040303@meisterderspiele.de> Date: Tue, 11 May 2010 16:26:29 +0200 From: =?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= 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 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: [Trigger] Help needed with NEW.* and TG_TABLE_NAME References: <6038.1273587810@sss.pgh.pa.us> In-Reply-To: <6038.1273587810@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.8 tagged_above=-5 required=5 tests=BAYES_50=0.8 X-Spam-Level: X-Archive-Number: 201005/41 X-Sequence-Number: 34089 Tom Lane schrieb: > =?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= writes: >> NEW.revision := addContentRevision (OLD.content_id, OLD.revision); > >> /* not working line, just a stub: >> EXECUTE 'INSERT INTO ' || TG_TABLE_NAME || ' SELECT $1 ' USING NEW; >> */ > >> RETURN NULL; > > This seems like the hard way. Why don't you just RETURN NEW and let the > normal insertion happen? The trigger catches an UPDATE, not an INSERT. I need the old and the new row, because this should emulate revision-control of the content. Greetings, Torsten