Re: pg_dumpall from a script

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Luca Ferrari <fluca1978(at)infinito(dot)it>, James Sewell <james(dot)sewell(at)lisasoft(dot)com>
Cc: Raghu Ram <raghuchennuru(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_dumpall from a script
Date: 2013-10-22 13:52:01
Message-ID: 52668301.9020407@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/21/2013 11:41 PM, Luca Ferrari wrote:
> On Tue, Oct 22, 2013 at 7:20 AM, James Sewell <james(dot)sewell(at)lisasoft(dot)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 from a :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(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Amit Langote 2013-10-22 13:55:36 Re: A client and server encoding question
Previous Message Merlin Moncure 2013-10-22 13:51:51 Re: Count of records in a row