pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Florian G. Pflug <fgp@phlo.org>
To: pgsql-general@postgresql.org
Subject: Problem creating trigger-function with arguments (8.0rc4)
Date: Fri, 07 Jan 2005 21:00:12 +0100
Message-ID: <41DEEA4C.8090903@phlo.org> (raw)

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

Attachments:

  smime.p7s (application/x-pkcs7-signature, 4.0K) download

view thread (7+ messages)  latest in thread

Message-ID: <41DEEA4C.8090903@phlo.org>
Permalink:  ../41DEEA4C.8090903@phlo.org/
Also on:    postgresql.org/message-id/41DEEA4C.8090903@phlo.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: fgp@phlo.org
  Subject: Re: Problem creating trigger-function with arguments (8.0rc4)
  In-Reply-To: <41DEEA4C.8090903@phlo.org>
  References: <41DEEA4C.8090903@phlo.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox