Skip to content

[bug] Switch database on query/notebook gets stuck — cannot revert, queries fail on wrong database #107

Description

@jcalfee

Describe the bug
After using “Switch database...” from the query results toolbar (... menu), the notebook/query becomes permanently bound to the new database. It is not possible to switch back. All subsequent queries (including on different tables) fail with “relation does not exist” errors because they execute against the wrong database. The stuck state sometimes survives closing/reopening the .pgsql file and restarting VSCodium.

To Reproduce

  1. Open a .pgsql notebook connected to Database A.
  2. Run a successful query on a table that exists in Database A (e.g. SELECT * FROM creator.cause LIMIT 100;).
  3. In the results toolbar, click the ... menu → Switch database... and select a different database (Database B).
  4. Run the same query (or queries on other tables).
  5. The query fails with ERROR 42P01: relation "..." does not exist.
  6. Try to switch back to Database A using the same menu — the binding remains stuck on Database B.
  7. Other tables/queries in the same notebook are also affected.

Expected behavior
Switching the database should be fully reversible. Queries should always run against the currently selected database. Closing and reopening the notebook or restarting VSCodium should restore the original database binding.

Screenshots

Image Image Image

Desktop (please complete the following information):

  • OS: Fedora 44
  • Editor: VSCodium
  • Extension: ric-v.postgres-explorer (PgStudio / NexQL)
  • Version: 1.4.1

Additional context

  • Behavior is inconsistent: sometimes closing the .pgsql file and reopening it restores the original database; other times the stuck state persists even after restarting VSCodium.
  • Duplicating the database connection was a workaround that restored functionality.
  • The issue affects the entire notebook session, not just the current query.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions