From: | Craig Ringer <craig(at)2ndquadrant(dot)com> |
---|---|
To: | Chapman Flack <chap(at)anastigmatix(dot)net> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Would a BGW need shmem_access or database_connection to enumerate databases? |
Date: | 2017-12-04 14:12:55 |
Message-ID: | CAMsr+YGWSfetkTh8o7P-5jVx3H1Nk9fyV-BbcqX_v8vR2eHnPA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 30 November 2017 at 06:48, Chapman Flack <chap(at)anastigmatix(dot)net> wrote:
> I'm thinking of writing a background worker that will enumerate
> the databases present, and spin off, for each one, another BGW
> that will establish a connection and do stuff.
>
> For the "master" one, what capabilities will it need to simply
> enumerate the current names of known databases? I suppose I could
> have it connect to the null dbname and query pg_database. Would
> that be the civilized way to do it, or am I missing a simpler way?
>
pglogical does exactly this. Take a look at start_manager_workers in
pglogical.c
https://github.com/2ndQuadrant/pglogical/blob/REL2_x_STABLE/pglogical.c#L594
and the caller pglogical_supervisor_main .
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2017-12-04 14:13:56 | Re: Would a BGW need shmem_access or database_connection to enumerate databases? |
Previous Message | Oliver Ford | 2017-12-04 14:11:46 | Add GROUPS option to the Window Functions |