Re: A simple extension immitating pg_notify

Поиск
Список
Период
Сортировка
От Mehran Ziadloo
Тема Re: A simple extension immitating pg_notify
Дата
Msg-id DUB121-W4559AC623AC17F516DBB5DD00C0@phx.gbl
обсуждение исходный текст
Ответ на Re: A simple extension immitating pg_notify  (John R Pierce <pierce@hogranch.com>)
Ответы Re: A simple extension immitating pg_notify  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: A simple extension immitating pg_notify  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I'm sorry, you are right. Let me rephrase that.

What I meant was that the notifications are received by the client connections
as if it was generated within their corresponding database (let's name the
database with a client connection listening to it; DB_C), then a notification 
generated by a NOTIFY command within DB_X like this:

pg_notify_db('DB_C', some_channel, 'payload');

can be heard by the client. Of course, the client needs to know which database
has sent the notification but I think we can skip that part since we can easily
include database name in the notification's payload if necessary.

That was one of the two solutions. The other one is like this:

pg_notify_all(some_channel, 'payload');

And this one sends the notification to all of the client connections,
regardless of which database they are connected/listening to.

I hope it makes sense now.



> Subject: Re: [GENERAL] A simple extension immitating pg_notify
> To: pgsql-general@postgresql.org
> From: pierce@hogranch.com
> Date: Sun, 24 Jul 2016 00:21:35 -0700
>
> On 7/23/2016 8:24 PM, Mehran Ziadloo wrote:
> > I'm looking for a way to send notifications from within one database to
> > another. As if pg_notify accepted a database name, or even to all of the
> > databases. So far I could not find a way to do so. Then someone told
> > me that I
> > need to implement this feature myself and add it PostgreSQL as an
> > extension.
> >
> > Being new to extension development, I have no idea where to start. Can
> > someone
> > please guide me to the right direction? I'm sure implementing such a
> > function
> > is pretty simple but only if you know where to start, which I don't!
> >
>
> how would a 'database' receive a notification? notifications are sent
> from SQL running on the database server to a listening client app.
>
>
>
> --
> john r pierce, recycling bits in santa cruz
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

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

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: A simple extension immitating pg_notify
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: A simple extension immitating pg_notify