Re: Passing parameters to triggers

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Passing parameters to triggers
Date: 2002-03-20 16:29:05
Message-ID: 20020320082809.D45997-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Thu, 14 Mar 2002, [iso-8859-1] Hans-Jrgen Schnig 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jan Wieck 2002-03-20 16:37:20 Re: Distributed databases and replication in postgresql 7.3
Previous Message Jeff Fitzmyers 2002-03-20 16:13:55 Re: plpgsql function docs