Re: Would a BGW need shmem_access or database_connection to enumerate databases? - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: Would a BGW need shmem_access or database_connection to enumerate databases?
Date
Msg-id CAMsr+YGWSfetkTh8o7P-5jVx3H1Nk9fyV-BbcqX_v8vR2eHnPA@mail.gmail.com
Whole thread Raw
In response to Would a BGW need shmem_access or database_connection to enumeratedatabases?  (Chapman Flack <chap@anastigmatix.net>)
List pgsql-hackers
On 30 November 2017 at 06:48, Chapman Flack 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

pgsql-hackers by date:

Previous
From: Oliver Ford
Date:
Subject: Add GROUPS option to the Window Functions
Next
From: Craig Ringer
Date:
Subject: Re: Would a BGW need shmem_access or database_connection to enumerate databases?