Skip to content

Fix PostgreSQL "Load Databases" error: PgTypeInfo(Name) not supported #27

@debba

Description

@debba

Description

The "Load Databases" feature fails when connecting to a PostgreSQL instance with the following error:
error occurred while decoding column datname: error in Any driver mapping: Any driver does not support the Postgres type PgTypeInfo(Name)

This happens because the datname column in the pg_database table uses the internal PostgreSQL name type, which sqlx's Any driver doesn't seem to support directly.

Steps to Reproduce

  1. Create a PostgreSQL connection.
  2. Click on "Load Databases" (which calls list_databases tauri command) in the connection modal.
  3. Observe the error message.

Expected Behavior

The list of databases should be loaded correctly.

Possible Fix

Cast datname to TEXT in the queries:

  1. In src-tauri/src/drivers/postgres.rs (function get_databases):
SELECT datname::text FROM pg_database WHERE datistemplate = false ORDER BY datname;
  1. In src-tauri/src/commands.rs (function list_databases):
SELECT datname::text FROM pg_database WHERE datistemplate = false ORDER BY datname;

Context

  • File: src-tauri/src/drivers/postgres.rs, src-tauri/src/commands.rs
  • Functions: get_databases, list_databases

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions