Re: pg_dumpall from a script - Mailing list pgsql-general

From Adrian Klaver
Subject Re: pg_dumpall from a script
Date
Msg-id 52668301.9020407@gmail.com
Whole thread Raw
In response to Re: pg_dumpall from a script  (Luca Ferrari <fluca1978@infinito.it>)
List pgsql-general
On 10/21/2013 11:41 PM, Luca Ferrari wrote:
> On Tue, Oct 22, 2013 at 7:20 AM, James Sewell <james.sewell@lisasoft.com> wrote:
>
>> I need a way to backup either from SQL in PSQL (possibly \!) or from a PG/PLSQL function to a file with a name set
froma :variable. 
>
> Could it be something like this:
>
> # \setenv myFile 'filename'
> # \! pg_dump > $myFile
>
> Unfortunately there seems to be no unsetenv command to remove the
> variable within the script.

Call it again without the variable value:

http://www.postgresql.org/docs/9.3/interactive/app-psql.html

\setenv [ name [ value ] ]
Sets the environment variable name to value, or if the value is not
supplied, unsets the environment variable

\setenv myFile

>
>
> Luca
>
>


--
Adrian Klaver
adrian.klaver@gmail.com


pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Count of records in a row
Next
From: Amit Langote
Date:
Subject: Re: A client and server encoding question