Skip to content

PostgreSQL metadata commands use a different database name than the actual connection database #124

Description

@blizhan

Description

dbvr meta database list reports a database name that does not match the database configured in the datasource or the database actually used by the PostgreSQL connection.

The SQL connection works correctly, but the metadata commands appear to use a different database/catalog name.

Environment

  • dbvr: 26.1.5.202608161900
  • Database: PostgreSQL-compatible
  • OS: Linux ARM64

The same behavior was also observed with dbvr 26.1.0.

Datasource configuration

The datasource is configured with a JDBC URL pointing to actual_db:

jdbc:postgresql://db.example.com:5432/actual_db

For example:

dbvr datasource view <datasource-id>

returns:

{
  "provider": "postgresql",
  "driver": "postgres-jdbc",
  "name": "example-ds",
  "save-password": true,
  "configuration": {
    "url": "jdbc:postgresql://db.example.com:5432/actual_db",
    "configurationType": "MANUAL",
    "type": "dev"
  }
}

Actual PostgreSQL connection

Running:

dbvr sql -ds=example-ds "select current_database();"

returns:

|current_database|
|----------------|
|actual_db       |
Rows read: 1

So the JDBC connection is definitely connected to actual_db.

Metadata result

However:

dbvr meta database list -ds=example-ds

returns:

unexpected_db

Trying to use the actual database name with a metadata command fails:

dbvr meta table list -ds=example-ds -db=actual_db -sn=public

Result:

Error evaluating cli: actual_db' not found

But using the incorrectly reported database name works:

dbvr meta table list -ds=example-ds -db=unexpected_db -sn=public

and correctly lists tables that actually belong to actual_db.

Expected behavior

dbvr meta database list -ds=example-ds should report:

actual_db

and metadata commands should accept:

-db=actual_db

since this is both:

  1. the database specified in the JDBC datasource URL; and
  2. the value returned by PostgreSQL current_database().

Actual behavior

The SQL layer connects to actual_db, while the metadata layer exposes it under a different database/catalog name (unexpected_db).

It appears that the database/catalog name resolved by the metadata layer is inconsistent with the actual JDBC connection database.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions