5

Every time I open pgAdmin I have to do this:

set search_path="schema";

Is there a way to set a default search path value?

Chin
  • 7,883
  • 22
  • 69
  • 95
  • Read here: [Postgresql Schema Path permanently](http://stackoverflow.com/questions/2875610/postgresql-schema-path-permanently/2875687) – informatik01 Apr 25 '13 at 15:08

3 Answers3

7

yes, you can modify the user:

alter role «user_name» set search_path = '«schema_name»';
maletin
  • 198
  • 1
  • 6
  • 2
    Note that the single quotes around the schema_name are optional, unless maybe you have some non alphanumeric characters in it. And of course you can set search_path to a comma separated list of schema names. – laurent Aug 04 '17 at 12:32
1

To set the value DB-wide you can also set a parameter for search_path in the database properties pane (confirmed in pgAdmin 5.7).

DB properties pane image

mwil.me
  • 111
  • 2
1

You can also use macro feature of pgAdmin III to simplify task.

Although first answer is correct you can accidentally overwrite user related configuration the app can rely on. If application is not well written or is very complex and you have to use the same user, it is better to use feature of pgAdmin.

I haven't found better working solution in pgAdmin III 1.20 than assigning a macro to keyboard shortcut with instruction to alter search path - it's a regular SET search_path=first_schema, second_schema I assume the best solution will be to set search_path property of DB instance for pgAdmin connection, but despite presence of Properties.../Variables tab in instance context menu it looks disabled.