Natarajan R <nataraj3...@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