Re: Regarding extension - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Regarding extension
Date
Msg-id 17058.1570166272@sss.pgh.pa.us
Whole thread Raw
In response to Re: Regarding extension  (Natarajan R <nataraj3098@gmail.com>)
Responses Re: Regarding extension  (Craig Ringer <craig@2ndquadrant.com>)
List pgsql-hackers
Natarajan R <nataraj3098@gmail.com> writes:
> Me:  Thanks Tomas, But this is for that particular database only, I want
> to get the *list of database Id's* on which my extension is installed
> during *PG_INIT* itself...

You can't.  In the first place, that information simply isn't obtainable,
because a session running within one database doesn't have access to the
catalogs of other databases in the cluster.  (You could perhaps imagine
firing up connections to other DBs a la dblink/postgres_fdw, but that will
fail because you won't necessarily have permissions to connect to every
database.)  In the second place, it's a pretty terrible design to be
attempting any sort of database access within _PG_init, because that
precludes loading that module outside a transaction; for example you
will not be able to preload it via shared_preload_libraries or allied
features.

We should back up about three steps and ask why you think you need
to do this.  Generally speaking, database code shouldn't be concerning
itself with what is happening in other databases.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: [HACKERS] Block level parallel vacuum
Next
From: Amit Kapila
Date:
Subject: Re: [HACKERS] Block level parallel vacuum