Skip site navigation (1) Skip section navigation (2)

Re: Running .psqlrc from a custom location

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Netzach <psql-novice(at)netzach(dot)co(dot)il>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Running .psqlrc from a custom location
Date: 2008-06-01 14:37:15
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Netzach <psql-novice(at)netzach(dot)co(dot)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

> 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

In response to

pgsql-novice by date

Next:From: Derrick BettsDate: 2008-06-01 14:49:15
Subject: Re: Running .psqlrc from a custom location
Previous:From: NetzachDate: 2008-06-01 09:27:12
Subject: Running .psqlrc from a custom location

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group