Re: Fwd: Identify system databases

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: Dominique Devienne <ddevienne(at)gmail(dot)com>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Igor Korot <ikorot01(at)gmail(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Fwd: Identify system databases
Date: 2025-04-16 14:39:14
Message-ID: 1898934.1744814354@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> writes:
> On Wed, 2025-04-16 at 10:09 +0200, Dominique Devienne wrote:
>> Authentication is cluster-wide, not DB specific, so I'd welcome a way to connect
>> to the cluster, not a specific DB, and introspect shared-objects,
>> including databases
>> I'm allowed to connect to, which could be an empty list.

> It is deep in the DNA of PostgreSQL that you always have to connect to
> a database, unless you establish a replication connection.
> I am surprised that you perceive that as a problem or limitation.

That isn't going to change, and here's why not: a lot of the critical
catalogs are per-database not shared. You aren't going to get
anywhere "introspecting shared objects" when you don't have a copy of
pg_class with which to find the shared catalogs, nor a copy of pg_proc
with which to look up index access method support procedures, etc etc.

You could imagine making up some mini-database that is somehow
forbidden from gaining any user-defined objects and then using
that, but I fail to see why that's a better idea than the
approach we use now. Not being able to use any user-defined
functions or views seems like a pretty huge handicap. And this
hypothetical new mini-database *would* be a special snowflake
in a way that none of the existing ones are, in that the system
would have to prevent actions that are perfectly okay in any
other one. I don't perceive that as a good thing.

(You can, of course, speculate about some major rearchitecting
of the system catalogs that would make this situation different.
I doubt that's going to happen at this point, though. There's
too much stuff that's dependent on how things are now.)

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2025-04-16 14:53:37 Re: Cannot turn track_counts on
Previous Message Ron Johnson 2025-04-16 12:36:06 Re: Best Tool for PostgreSQL Auditing and Storing Audit Logs Separately