Trigger and arguments question

From: Hervé Inisan <typo3(at)self-access(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Trigger and arguments question
Date: 2005-05-26 19:52:39
Message-ID: 20050526194951.1247A317E58@postfix4-1.free.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi everybody!

I have a trigger like this:

CREATE TRIGGER mytrigger
AFTER INSERT OR UPDATE OR DELETE
ON myschema.mytable
FOR EACH ROW
EXECUTE PROCEDURE myschema.myfunction(myarg);

It sends an argument to myfunction(), and I can retrieve this value in
TG_ARGV[0]. Fine.
What I'm trying to do is using TG_ARGV[0] to point to a field in NEW or OLD.
Is it possible?

Something like NEW.TG_ARGV[0]...

I'm trying to write a kind of generic function which I could use on multiple
tables with different field names (myarg being the field name).
But I can't get it to work.

Any clues or other solutions?
Thanks,
-- Hervé Inisan.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-05-26 20:29:44 Re: another failover testing question
Previous Message Vivek Khera 2005-05-26 19:48:08 Re: pg_listener records