From: Jeff Boes <jboes@nexcerpt.com>
To: pgsql-sql@postgresql.org
Subject: NOTIFY "string" from rule
Date: Fri, 22 Jun 2001 15:18:31 -0400
Message-ID: <9h05l0$1bke$1@news.tht.net> (raw)
Say my table looks like:
CREATE TABLE foo(status char(5), name char(5));
and I want to have a rule that does this:
CREATE RULE nf_foo AS
ON INSERT TO foo DO
NOTIFY new.status || '_' || new.name;
Any hints? My first attempt was to write a function:
CREATE FUNCTION bar(foo) RETURNS TEXT AS
'SELECT $1.status || ''_'' || $1.name;'
LANGUAGE 'sql';
and then change the last line of the rule to
NOTIFY bar(new);
but no luck. I would like to avoid writing a bunch of rules to process
each combination of 'status' and 'name' (at least they're each a limited
set!).
--
Jeff Boes vox 616.226.9550
Database Engineer fax 616.349.9076
Nexcerpt, Inc. jboes@nexcerpt.com
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jboes@nexcerpt.com
Subject: Re: NOTIFY "string" from rule
In-Reply-To: <9h05l0$1bke$1@news.tht.net>
* 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