Problem creating trigger-function with arguments (8.0rc4) - Mailing list pgsql-general

From Florian G. Pflug
Subject Problem creating trigger-function with arguments (8.0rc4)
Date
Msg-id 41DEEA4C.8090903@phlo.org
Whole thread Raw
Responses Re: Problem creating trigger-function with arguments (8.0rc4)  (Michael Fuhr <mike@fuhr.org>)
Re: Problem creating trigger-function with arguments (8.0rc4)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi

I want to create a simple trigger that denies inserts into a particular
table - but, since I want meaningfull error-messages, but don't
want to create a function for each table, I figured I could pass
the error-message to the trigger-function.
This is what I tried:

CREATE OR REPLACE FUNCTION functions.t_insert_deny(v_message text)
RETURNS "trigger" AS $$
begin
    raise exception '%', v_message ;
end ;
$$ LANGUAGE 'plpgsql' VOLATILE STRICT;

This results in a parse error at "v_message" (in the 4th line).

If I replace RETURNS "trigger" with e.g. RETURNS "int8" it works...
Is this is a bug, or has something regarding triggerfunctions and
parameters changed in 8.0 (I also try omiting the parameter name
in the function declartion, and using "$1" directly, but then
the error-message says "Unknown parameter $1").

greetings, Florian Pflug

Attachment

pgsql-general by date:

Previous
From: Tzahi Fadida
Date:
Subject: Re: ERROR: cache lookup failed for type 0
Next
From: "Craig Bryden"
Date:
Subject: MS-SQL to PostgreSQL