Received: from maia.hub.org (maia-4.hub.org [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 24F8C6330EB for ; Wed, 12 May 2010 03:01:06 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 21474-04 for ; Wed, 12 May 2010 06:00:58 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moon.antora.ru (moon.antora.ru [89.111.189.180]) by mail.postgresql.org (Postfix) with ESMTP id B538B632F22 for ; Wed, 12 May 2010 03:00:57 -0300 (ADT) Envelope-to: pgsql-sql@postgresql.org Received: from moon.inner.space ([10.1.1.5] helo=moon.antora.ru) by moon.antora.ru with esmtp (Exim 4.67) (envelope-from ) id 1OC502-0003hy-DK for pgsql-sql@postgresql.org; Wed, 12 May 2010 10:00:54 +0400 Received: from [192.168.1.6] [178.34.82.17] by moon.antora.ru (Axigen) with (DHE-RSA-AES256-SHA encrypted) ESMTPSA id 094D5E; Wed, 12 May 2010 10:00:54 +0400 Message-ID: <4BEA4415.2000902@bankir.ru> Date: Wed, 12 May 2010 10:00:53 +0400 From: silly sad User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.5) Gecko/20100111 Thunderbird/3.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> <4BE96915.8040303@meisterderspiele.de> In-Reply-To: <4BE96915.8040303@meisterderspiele.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit 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/46 X-Sequence-Number: 34094 On 05/11/10 18:26, Torsten Zühlsdorff wrote: > > > 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. just set whatever value u want to the fields of the row NEW.