Problem creating trigger-function with arguments (8.0rc4)

From: "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Problem creating trigger-function with arguments (8.0rc4)
Date: 2005-01-07 20:00:12
Message-ID: 41DEEA4C.8090903@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Bryden 2005-01-07 20:00:47 MS-SQL to PostgreSQL
Previous Message Tzahi Fadida 2005-01-07 19:51:30 Re: ERROR: cache lookup failed for type 0