Re: Set search_path for session

From: Scott Mead <scott(dot)lists(at)enterprisedb(dot)com>
To: Mary Sipple <msipple(at)iii(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Set search_path for session
Date: 2009-04-17 16:07:58
Message-ID: d3ab2ec80904170907i925447bifa748d3a05db4eca@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Apr 17, 2009 at 10:47 AM, Mary Sipple <msipple(at)iii(dot)com> wrote:

> We have a script wrapper for psql which reads a configuration file and
> constructs a psql command to connect to the configured instance of postgres.
> We would like to include a search_path setting in the configuraration file
> and have the wrapper use that to set the search_path for the psql session. I
> tried using the -v flag (-vsearch_path=xxxx) with the psql command but
> that did not work:
>
> > psql -h$SOCKET -U$USER -p$PORT -vsearch_path=$SCHEMAS $DBNAME
>
> The search_path remains at the default setting:
>
> iii=> show search_path;
>
> search_path
>
> ----------------
>
> "$user",public
>
> (1 row)
>
> Can anyone tell me how I can make this happen short of changing thesearch_path setting in postgresql.conf & restarting postgres?
>

In your users's home directory, place a '.psqlrc' file with the command 'set
search_path=<blah>'

http://www.postgresql.org/docs/8.3/static/app-psql.html

--Scott

In response to

Browse pgsql-general by date

  From Date Subject
Next Message stevefoss 2009-04-17 16:19:31 Migration/Upgrade Problems
Previous Message Scott Mead 2009-04-17 15:53:19 Re: Set search_path for session