Re: [Trigger] Help needed with NEW.* and TG_TABLE_NAME

From: silly sad <sad(at)bankir(dot)ru>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: [Trigger] Help needed with NEW.* and TG_TABLE_NAME
Date: 2010-05-12 06:00:53
Message-ID: 4BEA4415.2000902@bankir.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 05/11/10 18:26, Torsten Zühlsdorff wrote:
>
>
> Tom Lane schrieb:
>> =?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= <foo(at)meisterderspiele(dot)de> 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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Gnanakumar 2010-05-12 10:34:39 Invalid message format Exception
Previous Message Pavel Stehule 2010-05-12 05:45:36 Re: best paging strategies for large datasets?