Re: NOTIFY in Background Worker

Поиск
Список
Период
Сортировка
От Thomas Munro
Тема Re: NOTIFY in Background Worker
Дата
Msg-id CAEepm=2jP7RzLNVt2vAyV0XojF5PEJ64Ltb64hnW5GVHd=S0JA@mail.gmail.com
обсуждение исходный текст
Ответ на NOTIFY in Background Worker  (jacques klein <jacques.klei@googlemail.com>)
Ответы Re: NOTIFY in Background Worker  (Thomas Munro <thomas.munro@enterprisedb.com>)
Список pgsql-hackers
On Fri, Aug 28, 2015 at 10:30 PM, jacques klein <jacques.klei@googlemail.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.

--

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jim Nasby
Дата:
Сообщение: Re: proposal: multiple psql option -c
Следующее
От: Bruce Momjian
Дата:
Сообщение: Adding commit details to SGML release notes