Re: Would a BGW need shmem_access or database_connection to enumerate databases?

From: Michael Paquier <michael(dot)paquier(at)gmail(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-11-29 22:54:40
Message-ID: CAB7nPqTdi=J9HH8PPPiEOohebdd+xkgbbhdY7=VbGnZ3CkZXxA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 30, 2017 at 7:48 AM, Chapman Flack <chap(at)anastigmatix(dot)net> wrote:
> 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?

Yes. That's actually what the autovacuum launcher does. It connects
using InitPostgres(NULL, InvalidOid, NULL, NULL), and then scans
pg_database to fetch a list (see get_database_list).
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chapman Flack 2017-11-29 23:23:40 Re: Would a BGW need shmem_access or database_connection to enumerate databases?
Previous Message Michael Paquier 2017-11-29 22:49:19 Re: [HACKERS] Refactoring identifier checks to consistently use strcmp