On 30 November 2017 at 06:48, Chapman Flack <c...@anastigmatix.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

Reply via email to