From: | Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com> |
---|---|
To: | jacques klein <jacques(dot)klei(at)googlemail(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: NOTIFY in Background Worker |
Date: | 2015-08-28 21:03:17 |
Message-ID: | CAEepm=2jP7RzLNVt2vAyV0XojF5PEJ64Ltb64hnW5GVHd=S0JA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Aug 28, 2015 at 10:30 PM, jacques klein <jacques(dot)klei(at)googlemail(dot)com
> wrote:
> Hello,
>
> I added a "NOFITY chan" to the SQL arg of an SPI_execute(), (I did it also
> with just the NOTIFY statement),
> but the listeners (other workers) don't get the notification until a
> "NOTIFY chan" is done for example with pgadmin,
>
> They don't get lost, just not emited after the "not forgotten" call of
> CommitTransactionCommand().
>
> Is this normal ( i.e. not supported (yet) ), a bug, or did I overlook some
> doc. (or source code) ?.
>
> For now, I will try to "emit" the NOTIFY via libpq.
>
That's because ProcessCompletedNotifies isn't being called. For regular
backends it is called inside the top level loop PostgresMain. I think you
need to include "commands/async.h" and add a call to
ProcessCompletedNotifies() after your background worker commits to make
this work.
--
Thomas Munro
http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2015-08-28 21:12:00 | Adding commit details to SGML release notes |
Previous Message | Jim Nasby | 2015-08-28 21:01:44 | Re: proposal: multiple psql option -c |