From: | Scott Ribe <scott_ribe(at)elevated-dev(dot)com> |
---|---|
To: | ivan_14_32 <ivan_14_32(at)mail(dot)ru> |
Cc: | PostgreSQL general <pgsql-general(at)postgresql(dot)org>, Merlin Moncure <mmoncure(at)gmail(dot)com> |
Subject: | Re: Notify rule |
Date: | 2011-02-22 18:03:42 |
Message-ID: | AFC95575-9FE2-4CF7-ADCA-9FD70AB8356E@elevated-dev.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Feb 22, 2011 at 1:03 AM, ivan_14_32 <ivan_14_32(at)mail(dot)ru> wrote:
> Hi!
> I trying to create rule for update notifing:
>
> CREATE OR REPLACE RULE "ttt_NotifyU" AS
> ON UPDATE TO "ttt" DO
> NOTIFY "ttt", '88';
> this work.
>
> But this
> CREATE OR REPLACE RULE "ttt_NotifyU" AS
> ON UPDATE TO "ttt" DO
> NOTIFY "ttt", NEW."id";
> don't (syntax error),
> NOTIFY "ttt", CAST(NEW."id" as text)
> too.
>
> Q: How can I send tuple id (integer primary key) via notify using Rule?
> Target is erasing deprecated tuples from application's cache.
Well, that second argument to NOTIFY must be a literal. If you need to notify with a dynamic value, then you need to use the pg_notify function instead--regardless of whether you use a rule or a trigger.
--
Scott Ribe
scott_ribe(at)elevated-dev(dot)com
http://www.elevated-dev.com/
(303) 722-0567 voice
From | Date | Subject | |
---|---|---|---|
Next Message | Howard Cole | 2011-02-22 18:16:06 | Re: Reordering a table |
Previous Message | David Johnston | 2011-02-22 18:03:40 | Re: Reordering a table |