Search Postgresql Archives

Re: Trigger and arguments question

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

 



On 5/26/05, Hervé Inisan <typo3@xxxxxxxxxxxxxxx> 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?
> 
> 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?
No. the argument of the trigger must be a string literal defined at
creation time.

maybe you better solution is simply a function

-- 
regards,
Jaime Casanova
(DBA: DataBase Aniquilator ;)

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


[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