By NHI Mgmt Group Editorial TeamBased on StrongDM: “How to List All Databases in PostgreSQL (psql and More)” (June 25, 2025)

TL;DR: Listing all PostgreSQL databases is presented as an operational task, but the real issue is whether access to inventory, metadata, and administrative controls is governed tightly enough to avoid unintended exposure, according to StrongDM. For IAM teams, the lesson is that database visibility, privilege scope, and auditability belong in the same governance conversation as access paths.


At a glance

What this is: This is a PostgreSQL how-to article that argues database listing becomes an access control problem when visibility, permissions, and auditability are not governed together.

Why it matters: It matters because IAM and PAM teams often treat database discovery as harmless, when in practice the same permissions that expose inventory can also expose administrative pathways and privilege scope.


Context

Listing databases in PostgreSQL is not just a usability task. The permission needed to see database inventory is itself part of the access model, and that means discovery, visibility, and administrative scope need to be governed together rather than treated as separate operations.

For identity teams, the real question is whether database metadata and access paths are constrained tightly enough to prevent unintended exposure. If a user can enumerate databases freely, that visibility can become an indirect map of what the environment contains and how control is organized.

That makes the article relevant to IAM and PAM practice, not just PostgreSQL administration. The central issue is whether the access model reflects least privilege when a user asks to see what exists rather than to change what exists.


Key questions

Q: What breaks when too many users can create or drop PostgreSQL tables?

A: When too many users can create or drop PostgreSQL tables, schema change stops being a controlled administrative function and becomes a standing production risk. You lose clear accountability, increase the chance of accidental data loss, and make it harder to prove that destructive actions were authorised. The right boundary is privilege scope, not just login access.

Q: Why does data visibility matter to IAM and governance teams?

A: Because identity controls are only part of the picture when sensitive data is distributed across cloud, SaaS, backups, and AI-driven workflows. If teams cannot see where the data lives, they cannot judge who should access it, which copies are safe, or how recovery should be prioritised after an incident.

Q: What do security teams get wrong about PostgreSQL access control?

A: They often separate discovery from privilege management. In practice, the right to list databases, browse objects, or inspect catalog metadata is itself an access control decision. When teams treat those paths as harmless, they miss the fact that they are widening the exposure surface for administrative intelligence.

Q: Should access reviews include database inventory visibility?

A: Yes. If a role can see database names, owners, or connection details, that visibility should be reviewed like any other privileged entitlement. The review should confirm that the access is still operationally necessary and that the same permission is not being granted across multiple tools without consistent logging.


Technical breakdown

Why PostgreSQL database listing is an authorization decision

In PostgreSQL, listing databases is not a neutral read-only action. It depends on whether the connecting account has enough privilege to see catalog metadata such as pg_database, database properties, and connection details. That means the control surface is not just the query or GUI tool. It is the combination of role assignment, server authentication, and the permissions that determine which objects remain visible to the session. In governance terms, visibility itself is an entitlement, and entitlements should be reviewed with the same discipline as write access.

Practical implication: review who can enumerate database inventories and treat that permission as a governed entitlement, not a default convenience.

How psql, SQL, and GUI tools expose different metadata paths

The article shows several ways to list databases, including psql meta-commands, direct SQL against pg_database, and GUI tools such as pgAdmin and DBeaver. Those methods are technically different, but they converge on the same problem: each creates a path to inventory and metadata, and each path can be governed differently. A session that can query pg_database may be constrained differently from one that can browse objects through a graphical console. Security teams therefore need to think about discovery paths as separate access routes, not as one generic administrative capability.

Practical implication: inventory every database discovery path and align each one to a specific role, scope, and audit trail.

Why pg_hba.conf and authentication settings define exposure

The article notes that permission denied errors can lead operators to adjust pg_hba.conf, authentication methods, or listen_addresses. Those settings do more than fix connectivity. They define which clients can reach the database, which authentication methods are accepted, and how permissive the network path is before a user ever reaches a query. In other words, PostgreSQL visibility is bounded by connection policy as much as by SQL privilege. If those boundaries are loosened casually, database enumeration becomes part of a broader exposure problem.

Practical implication: change connection policy only through controlled access review and verify that network reachability matches intended privilege scope.


Read and download The State of NHI & AI Agent Breach Report 2026, covering 150+ breaches impacting Non-Human Identities including AI Agents.


NHI Mgmt Group analysis

Database listing is an authorization boundary, not a convenience feature. The moment a user can enumerate PostgreSQL databases, the organisation has already made a privilege decision about inventory visibility. That decision affects operational secrecy, administrative hygiene, and how easily an attacker can map the environment. The practitioner conclusion is simple: treat database enumeration as governed access, not harmless discovery.

Access to metadata is often the real control plane. The article's examples show that psql, SQL queries, and GUI tools all surface information that can help a user understand the shape of the estate. That is why the issue belongs in IAM and PAM conversations, not just DBA runbooks. The practitioner conclusion is to classify inventory visibility by role and review it like any other privileged entitlement.

Least privilege must cover visibility, not just modification rights. Teams often focus on who can change data and overlook who can see what exists. In PostgreSQL, database names, owners, and connection details are part of the attack surface because they help define what can be targeted next. The practitioner conclusion is to reduce unnecessary discovery rights wherever administrative necessity does not justify them.

Auditable database access needs one policy model across tools. The article moves between command line, SQL, GUI, scripts, and container access, which is exactly where governance often fragments. If one tool path is monitored and another is not, identity controls become inconsistent even when the database is the same. The practitioner conclusion is to enforce the same access and logging rules across every route into PostgreSQL inventory.

PostgreSQL inventory creates identity blast radius when privileged visibility is broad. Broader access to list databases expands the set of users who can learn which systems exist, how they are named, and which administrative patterns are in use. That information may be operationally useful, but it also widens the reconnaissance surface. The practitioner conclusion is to narrow visibility to the minimum administrative set that genuinely needs it.

From our research library:

What this signals

Inventory visibility is a governance control: PostgreSQL database listing should be governed as an entitlement because it reveals the shape of the environment before any data is touched. Teams that allow broad catalog access without review create a wider reconnaissance surface than they intend.

Access control needs to be consistent across psql, SQL, GUI tools, scripts, and container sessions. If the same user can discover the estate through one path and not another, the governance model is already fragmented.

The practical challenge is not whether teams can list databases. It is whether database visibility is limited to identities that truly need it and whether those paths are logged, reviewed, and aligned to least privilege.


For practitioners

  • Restrict database enumeration to named administrative roles Limit who can list databases, query catalog tables, or browse server objects to roles that genuinely need inventory visibility for operations or support.
  • Separate discovery access from modification access Do not allow users to inherit broad visibility just because they need occasional operational access. Make inventory visibility its own entitlement and review it separately.
  • Standardise auditing across command line and GUI paths Ensure psql sessions, SQL catalog queries, pgAdmin browsing, scripts, and container-based access all produce the same audit trail and are reviewed under the same policy.
  • Treat pg_hba.conf changes as privileged changes Review authentication and network reachability changes through the same approval and logging process used for other sensitive database access updates.

Key takeaways

  • PostgreSQL database listing is an authorization issue because visibility into inventory and metadata is itself a governed privilege.
  • The article shows multiple access paths, which means control gaps can appear when command line, SQL, GUI, and container routes are not governed consistently.
  • IAM and PAM teams should review who can enumerate databases, because over-broad visibility expands reconnaissance and weakens least privilege.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10 addresses the attack and risk surface, while NIST CSF 2.0, CIS Controls v8 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST CSF 2.0PR.AA-05 — Access Permissions, Entitlements and AuthorizationsThe article is fundamentally about who can enumerate databases and view metadata.
Recommendation — Review PostgreSQL inventory visibility against PR.AA-05 and remove unnecessary enumeration rights.
CIS Controls v8CIS-5 — Account ManagementDatabase listing permissions are governed through account and role assignment.
Recommendation — Align PostgreSQL access roles with CIS-5 and remove broad catalog visibility from non-admin accounts.
NIST SP 800-53 Rev 5AC-6 — Least PrivilegeThe article's core issue is excessive visibility and access scope.
Recommendation — Apply AC-6 to scope database enumeration to only the identities that need it.
OWASP Non-Human Identity Top 10NHI-05 — Overprivileged NHIScripts, service access, and containerised access can turn database visibility into excessive non-human privilege.
Recommendation — Reduce overprivileged database access paths and review non-human accounts that can enumerate PostgreSQL assets.

Key terms

  • Database Enumeration: The act of discovering which databases exist inside a PostgreSQL environment. In governance terms, enumeration is a visibility privilege, not a harmless query, because it reveals environment structure that can inform both legitimate administration and misuse.
  • CAD Metadata: CAD metadata is the descriptive information embedded in a design file or attached to it by the engineering workflow. It can include authorship, timestamps, revision counters, project codes, customer references, and security markings. For security teams, metadata often matters as much as the model itself.
  • Privilege visibility: Privilege visibility is the ability to see which identities can reach which systems, under what conditions, and with what level of access. For SSH-based workflows, it is the difference between knowing traffic is encrypted and knowing who actually exercised the access path.
  • Privilege Scope: Privilege scope is the set of actions, data, and tools an identity is allowed to use. For AI agents, scope must be defined around the task and the acceptable blast radius, because broad or persistent privileges can turn a small mistake into a production-level incident.

Deepen your knowledge

NHI governance, agentic AI identity, and machine identity lifecycle are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If you are building or maturing an IAM programme, it is worth exploring.
NHIMG Editorial Note
Published by the NHIMG editorial team on June 8, 2026.
Updated on October 8, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org