Re: [Trigger] Help needed with NEW.* and TG_TABLE_NAME - Mailing list pgsql-sql

From Torsten Zühlsdorff
Subject Re: [Trigger] Help needed with NEW.* and TG_TABLE_NAME
Date
Msg-id 4BE96915.8040303@meisterderspiele.de
Whole thread Raw
In response to Re: [Trigger] Help needed with NEW.* and TG_TABLE_NAME  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [Trigger] Help needed with NEW.* and TG_TABLE_NAME
List pgsql-sql

Tom Lane schrieb:
> Torsten Zühlsdorff <foo@meisterderspiele.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.

Greetings,
Torsten


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: [Trigger] Help needed with NEW.* and TG_TABLE_NAME
Next
From: Torsten Zühlsdorff
Date:
Subject: [Trigger] Help needed with NEW.* and TG_TABLE_NAME