Re: Running .psqlrc from a custom location - Mailing list pgsql-novice

From Tom Lane
Subject Re: Running .psqlrc from a custom location
Date
Msg-id 20003.1212331035@sss.pgh.pa.us
Whole thread Raw
In response to Running .psqlrc from a custom location  (Netzach <psql-novice@netzach.co.il>)
List pgsql-novice
Netzach <psql-novice@netzach.co.il> writes:
> I use a hack to make psql automatically set search_path to the relevant
> schema for the dump directory I am currently working in. I achieved this
> by running a wrapper script that changed the HOME environment variable,
> setting a variable on the command line, and having the .psqlrc in the
> custom location use that variable to set the search path. I just
> upgraded to 8.1 from 7.4 and my hack stopped working - apparently psql
> does not use the $HOME variable any more.

No, it doesn't, and changing $HOME is probably a pretty bad idea in any
case.

> My scripts are included below. I do not wish to run these commands every
> time I use psql, only when I run it from the wrapper script. As far as I
> am aware there is no way of setting search_path/schema from the command
> line.

Try something like
    export PGOPTIONS="--search-path=foo,bar"
before starting psql.

            regards, tom lane

pgsql-novice by date:

Previous
From: Netzach
Date:
Subject: Running .psqlrc from a custom location
Next
From: Derrick Betts
Date:
Subject: Re: Running .psqlrc from a custom location