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?

1

3 Answers 3

7

yes, you can modify the user:

alter role «user_name» set search_path = '«schema_name»';
1
  • 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
    Commented Aug 4, 2017 at 12:32
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.

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

1
  • This setting will be stored on the database server and will affect other clients.
    – basin
    Commented Oct 28, 2021 at 15:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .