pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Yury Don <yura@vpcit.ru>
To: pgsql-sql@postgresql.org
Subject: Re: plpgsql notify trigger
Date: Thu, 1 Mar 2001 09:26:30 +0500
Message-ID: <112762504.20010301092630@vpcit.ru> (raw)
In-Reply-To: <01022816004403.01482@pen>
References: <01022816004403.01482@pen>

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





view thread (2+ messages)

Message-ID: <112762504.20010301092630@vpcit.ru>
Permalink:  ../112762504.20010301092630@vpcit.ru/
Also on:    postgresql.org/message-id/112762504.20010301092630@vpcit.ru

 · 

reply

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: yura@vpcit.ru
  Subject: Re: plpgsql notify trigger
  In-Reply-To: <112762504.20010301092630@vpcit.ru>
  References: <01022816004403.01482@pen> <112762504.20010301092630@vpcit.ru>

* 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