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

From: Andres Freund <andres(at)anarazel(dot)de>
To: Chapman Flack <chap(at)anastigmatix(dot)net>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Would a BGW need shmem_access or database_connection to enumerate databases?
Date: 2017-11-29 23:34:24
Message-ID: 20171129233424.qj4hcb3nlrji6gry@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017-11-29 18:23:40 -0500, Chapman Flack wrote:
> On 11/29/2017 05:54 PM, Michael Paquier wrote:
>
> > 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).
>
> Thanks! It looks like if get_database_list were not static, it
> would be just the thing I'm looking for.
>
> Would an SPI query of pg_database also work, in the
> bgw-connected-to-null-dbname context? I'm just wondering if
> that might be clearer/fewer LOC than just copying the lower-level
> approach from get_database_list.

SQL won't really work in a non-database connected context.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Petr Jelinek 2017-11-29 23:40:36 Re: [HACKERS] logical decoding of two-phase transactions
Previous Message Tomas Vondra 2017-11-29 23:30:37 Re: [HACKERS] Custom compression methods