Skip to content

Feature request: Make use of pg_database for catalog listings #2949

@pip25

Description

@pip25

I'm submitting a ...

  • bug report
  • feature request

Describe the issue
I'd be willing to work on this and submit a PR (along with fixing a few other catalog-specific oddities in the implementation of DatabaseMetaData), but I thought I'd test the waters first. :)

PostgreSQL does not support multiple catalogs per connection, which is why it makes sense that methods such as setCatalog on Connection are no-op. However, PostgreSQL does in fact share the "system table" pg_database across all catalogs, making it possible to see what other catalogs exist and potentially open connections to them.
Right now, the driver only returns the current catalog for the getCatalogs implementation of DatabaseMetaData which unfortunately makes it impossible to check what other databases exist without resorting to DB-specific queries. I'd like to modify this implementation so that it returns the names in pg_database. Results of other metadata methods involving catalog names would not be affected (though I would suggest adding validations to them for catalog values that the current connection simply cannot support).

Driver Version?
v42.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions