Skip to content

Improve schema search_path handling (overwrite → append/prepend) #51

Description

@aesslinger

Migrated from tabularis#653. Part of the Phase 2 set of PostgreSQL-specific features beyond the built-in driver.

Problem

Selecting a schema in the UI sets search_path by overwriting it to just that one schema (SET search_path TO "<schema>" — see src/handlers/query.rs's exec_query/schema-setting logic), rather than prepending/appending it onto the connection's actual configured search_path. This breaks queries against objects that live in a different schema than the one currently selected: the user has to manually run SET search_path TO public, analyst; select * from whatever; as a workaround, split across two tabs.

Original report (tabularis#653):

tabularis should query the search path on a new connection and then use that, with the selected schema appended on the end. Maybe Ideally there would be a way to define or override that behaviour with a connection specific search_path rather than the one defined in postgresql.conf

Proposed approach

  • On connect, query the server's actual configured search_path (SHOW search_path or current_setting('search_path')) instead of assuming it's unset.
  • When a schema is selected in the UI, append it to (or prepend, matching Postgres's own resolution order) the connection's real search_path rather than replacing it outright.
  • Consider a per-connection search_path override setting (distinct from the schema selector) for users who want to permanently set an environment across sessions, per the original request.

Notes

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions