NOTIFY from PL/pgSQL trigger procedure

From: Mikhail Terekhov <terekhov(at)emc(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: NOTIFY from PL/pgSQL trigger procedure
Date: 2000-08-10 14:50:48
Message-ID: 3992C148.DB7B748F@emc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Is it possible to use variable as a notify name inside PL/pgSQL trigger
procedure? I'd like to create generic function like this:

CREATE FUNCTION send_notify() RETURNS OPAQUE AS '
DECLARE
notifyname text;
BEGIN
notifyname := TG_RELNAME || TG_OP;
NOTIFY notifyname;
RETURN NULL;
END;
' LANGUAGE 'plpgsql';

CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON test FOR EACH ROW
EXECUTE PROCEDURE send_notify();

But when this procedure is called I'm getting an error:

ERROR: parser: parse error at or near "$1"

What is wrong here?

Regards,
Mikhail

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Louis-David Mitterrand 2000-08-10 15:26:46 problem with float8 input format
Previous Message Philip Hallstrom 2000-08-10 14:48:53 Re: PSQL woes