Re: Accessing environment variables from psql (SOLVED)

From: Andreas Seltenreich <seltenreich(at)gmx(dot)de>
To: "Leif B(dot) Kristensen" <leif(at)solumslekt(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Accessing environment variables from psql (SOLVED)
Date: 2005-04-10 01:39:08
Message-ID: 874qef1kcj.fsf@gate450.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Leif B. Kristensen writes:

> So, the problem is solved, sort of. It may also be prudent to save the
> old pwd and return there when the work is done:
>
> leif=> \set olddir `echo $PWD`
> leif=> \set importdir `echo $IMPORTDIR`
> leif=> \cd :importdir
> leif=> \i test.sql
> leif=> \cd :olddir

You can concatenate values using \set. So using

\set importfile :importdir /test.sql
\i :importfile

you won't have to mess with $PWD.

regards,
Andreas

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Brian K Boonstra 2005-04-10 03:09:02 Note: Compiling on Windows with free Microsoft compilers
Previous Message Benjamin Smith 2005-04-09 22:41:55 Lost in Foreign Key land