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
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_pathby overwriting it to just that one schema (SET search_path TO "<schema>"— seesrc/handlers/query.rs'sexec_query/schema-setting logic), rather than prepending/appending it onto the connection's actual configuredsearch_path. This breaks queries against objects that live in a different schema than the one currently selected: the user has to manually runSET search_path TO public, analyst; select * from whatever;as a workaround, split across two tabs.Original report (tabularis#653):
Proposed approach
search_path(SHOW search_pathorcurrent_setting('search_path')) instead of assuming it's unset.search_pathrather than replacing it outright.search_pathoverride setting (distinct from the schema selector) for users who want to permanently set an environment across sessions, per the original request.Notes
tabularis'sdrivers/postgres/mod.rs'sacquire_pg_client), so this isn't a plugin-specific regression — but since this plugin'shandlers::query::exec_queryowns the fix location now, and the built-in driver is on a deprecation path (this plugin is intended to supersede it), doing it here is the right call.