Re: Trigger and arguments question

From: Hervé Inisan <typo3(at)self-access(dot)com>
To: "'Alban Hertroys'" <alban(at)magproductions(dot)nl>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Trigger and arguments question
Date: 2005-05-27 11:53:02
Message-ID: 20050527115011.B589FC006@postfix3-2.free.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Hervé Inisan wrote:
> > 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?
>
> You'll be missing OLD and NEW on INSERT and DELETE
> respectively, I'm afraid. You may want to split your triggers
> for different events.

Thank you all for your answers.
I tried with EXECUTE, with you're right: no way to build a NEW.field
dynamically.

-- Hervé Inisan.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Parker 2005-05-27 13:37:25 Re: another failover testing question
Previous Message Peter Eisentraut 2005-05-27 11:35:46 Re: relocation error-urgent