From: | Hans-Jürgen Schönig <hs(at)cybertec(dot)at> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Passing parameters to triggers |
Date: | 2002-03-14 14:39:32 |
Message-ID: | 3C90B624.4AF5875F@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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];
END IF;
RETURN OLD;
END;
' LANGUAGE 'plpgsql';
CREATE TRIGGER trig_a_b AFTER DELETE OR UPDATE ON a
FOR EACH ROW EXECUTE PROCEDURE checkint('b');
DELETE FROM a;
When running the code I get a strange problem. The RAISE NOTICE command
works but somehow the DELETE statements displays an error.
NOTICE: b wert
NOTICE: Error occurred while executing PL/pgSQL function checkint
NOTICE: line 4 at SQL statement
ERROR: parser: parse error at or near "$1"
Does anybody know what I can do?
Hans
From | Date | Subject | |
---|---|---|---|
Next Message | Hillensbeck, Preston | 2002-03-14 14:57:49 | Random Numbers/Letters |
Previous Message | Dean Scott | 2002-03-14 14:30:15 | Adding a Language and Creating a Function |