Re: plpgsql notify trigger

From: Yury Don <yura(at)vpcit(dot)ru>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: plpgsql notify trigger
Date: 2001-03-01 04:26:30
Message-ID: 112762504.20010301092630@vpcit.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message guard 2001-03-01 05:19:19 Re: int2+float8 problems
Previous Message Justin Clift 2001-03-01 04:21:11 Re: Help needed -> ERROR: record arow has no field description