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