Search Postgresql Archives

Re: Trigger and arguments question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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.



---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux