From: George Young <gry@ll.mit.edu>
To: pgsql-sql@postgresql.org
Subject: plpgsql notify trigger
Date: Wed, 28 Feb 2001 14:30:07 -0500
Message-ID: <01022816004403.01482@pen> (raw)
[postgres 7.0.2, x86 linux]
I am trying to use a trigger to perform an sql 'notify' command.
I do something like:
CREATE FUNCTION run_changed() RETURNS opaque AS '
declare
nm text;
begin
nm := NEW.run_name;
notify nm
return null;
end;
' LANGUAGE 'plpgsql';
create trigger run_changed_tr after update on runs for each row
execute procedure run_changed();
BUT, when I update the table, I get:
ERROR: parser: parse error at or near "$1"
It looks like the *name* (or it's alias here: $1.run_name), not the *value* of the variable nm,
is passwd to the notify command. Since notify only takes a name, not a string,
I don't see how to proceed.
Is there some way in plsql to construct a string and have it executed in sql?
disappointed in plsql,
George
--
George Young, Rm. L-204 gry@ll.mit.edu
MIT Lincoln Laboratory
244 Wood St.
Lexington, Massachusetts 02420-9108 (781) 981-2756
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-sql@postgresql.org
Cc: gry@ll.mit.edu
Subject: Re: plpgsql notify trigger
In-Reply-To: <01022816004403.01482@pen>
References: <01022816004403.01482@pen>
* 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