Re: Passing parameters to triggers - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Passing parameters to triggers
Date
Msg-id 20020320082809.D45997-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Passing parameters to triggers  (Hans-Jürgen Schönig <hs@cybertec.at>)
List pgsql-general
On Thu, 14 Mar 2002, [iso-8859-1] Hans-J�rgen Sch�nig wrote:

> I have a severe problem when working with PL/pgSQL triggers. Somehow the
> problem seems to be strange. Here is the code:
>
> CREATE OR REPLACE FUNCTION checkint () RETURNS opaque AS
> '
>         BEGIN
>                 IF      TG_OP = ''DELETE'' THEN
>                         RAISE NOTICE ''% wert'', TG_ARGV[0];
>                         DELETE FROM TG_ARGV[0];

EXECUTE ''DELETE FROM '' || TG_ARGV[0];
will probably do what you want.  You can't directly
substitute variables for tables, columns etc but you
can use execute to run a command string.



pgsql-general by date:

Previous
From: Jeff Fitzmyers
Date:
Subject: Re: plpgsql function docs
Next
From: Jan Wieck
Date:
Subject: Re: Distributed databases and replication in postgresql 7.3