trigger parameters, what am I doing wrong ??

From: "Marcin Krawczyk" <jankes(dot)mk(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: trigger parameters, what am I doing wrong ??
Date: 2008-10-09 07:11:18
Message-ID: 95f6bf9b0810090011w12b9d97p76bc81f5106e028f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi guys. I'm trying to pass a parameter to trigger procedure but it's not
working and I have no idea why since it looks pretty ok. Here's what I do :

CREATE OR REPLACE FUNCTION test_proc()
RETURNS "trigger" AS
$BODY$
DECLARE
chk boolean;
par integer := TG_ARGV[0];

BEGIN
RAISE NOTICE 'TG_ARGV = %, TG_NARGS = %, par = %', TG_ARGV[0], TG_NARGS,
par;

-- [...] some computations

RETURN NEW;
END;

$BODY$
LANGUAGE 'plpgsql' VOLATILE;

CREATE TRIGGER jks_test_proc_tg
AFTER UPDATE
ON test_table
FOR EACH ROW
EXECUTE PROCEDURE test_proc(42);

And here's what RAISE NOTICE looks like : NOTICE: TG_ARGV = <NULL>,
TG_NARGS = 0, par = <NULL>

What's wrong with it ?? I'm running 8.1.4

regards
mk

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Sabin Coanda 2008-10-09 09:37:09 Re: 100% CPU at concurent access
Previous Message Dirk Jagdmann 2008-10-09 06:20:46 Re: Insert a space between each character