Search path / Schema
I'm trying to run queries on vscode. However, in other software I can change the search path or the schema to facilitate the queries. so instead of putting: select * from "schema". "table_name" I can just put select * from table_name If this is possible, can someone help me?
I would also like to set a default schema or search path. A workaround is to run SET search_path TO <whatever>, but it would be great if there was a setting to do this automatically up on connection. DBeaver has a "Default schema" setting under Connection Settings -> Initialization. Cheers!
I second that. We have over a dozen schemas in our main database, and it would help to be able to set the search_path for an entire query file, some of which are 1000s of lines long and where table names are not prefixed with schema names, when you only want to execute one query in the middle of the file.
The following works fine when I execute the psql file as a whole, but it would be great if it worked when I select (highlight) only one query.
set search_path = my_client_schema;
SELECT count(*)
FROM dimreader dr
;
SELECT *
FROM dimreader dr
inner join reader r on dr.readerid = r.id
where r.classid = '1A'
;
So if it would be possible to set the schema for the project/file that would be great. The extension would just need to use set search_path = my_client_schema; throughout the session. And preferably use the schema for autocomplete too. That would make my life better 😃