Received: from vpcit.ru (dialup.vpcit.ru [195.38.52.246]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f214QGx62277 for ; Wed, 28 Feb 2001 23:26:16 -0500 (EST) (envelope-from yura@vpcit.ru) Received: (qmail 32731 invoked from network); 1 Mar 2001 04:25:19 -0000 Received: from gercon.vpcit.ru (195.38.52.226) by dialup.vpcit.ru with SMTP; 1 Mar 2001 04:25:18 -0000 Date: Thu, 1 Mar 2001 09:26:30 +0500 From: Yury Don X-Mailer: The Bat! (v1.49) Reply-To: Yury Don Organization: Gercon X-Priority: 3 (Normal) Message-ID: <112762504.20010301092630@vpcit.ru> To: pgsql-sql@postgresql.org Subject: Re: plpgsql notify trigger In-reply-To: <01022816004403.01482@pen> References: <01022816004403.01482@pen> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200102/435 X-Sequence-Number: 1640 Hello George, Once, Thursday, March 01, 2001, 12:30:07 AM, you wrote: GY> [postgres 7.0.2, x86 linux] GY> I am trying to use a trigger to perform an sql 'notify' command. GY> I do something like: GY> CREATE FUNCTION run_changed() RETURNS opaque AS ' GY> declare GY> nm text; GY> begin GY> nm := NEW.run_name; GY> notify nm GY> return null; GY> end; GY> ' LANGUAGE 'plpgsql'; GY> create trigger run_changed_tr after update on runs for each row GY> execute procedure run_changed(); GY> BUT, when I update the table, I get: GY> ERROR: parser: parse error at or near "$1" GY> It looks like the *name* (or it's alias here: $1.run_name), not the *value* of the variable nm, GY> is passwd to the notify command. Since notify only takes a name, not a string, GY> I don't see how to proceed. GY> Is there some way in plsql to construct a string and have it executed in sql? GY> disappointed in plsql, GY> George Trigger function must return record, try "return NEW" instead of "return null" -- Best regards, Yury