Re: PGPASSWORD - More than one in a bash script

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Patrick B <patrickbakerbr(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: PGPASSWORD - More than one in a bash script
Date: 2016-08-18 11:39:30
Message-ID: CAKFQuwYhdc=1tWPDo6S3_Sw9yyhatLfTBesmKuKG-w2-3AcHOw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday, August 18, 2016, Patrick B <patrickbakerbr(at)gmail(dot)com> wrote:

> Hi guys,
>
> I'm writing a bash script to dump and restore (pg_dump + pg_restore) a
> test database.
>
> However, the username to access the pg_dump server is different of the one
> to access pg_restore.
>
> I'm using the PGPASSWORD parameter on the script, but can I put two of
> that?
>
> like:
>
>> PGPASSWORD
>> PGPASSWORD2
>
> If not, do you guys have any idea how I could do this?
>
> I'm using PostgreSQL 9.5
>

You cannot. Instead, create your own variables and then, in the script,
assign their values to pgpassword when appropriate.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ilya Kazakevich 2016-08-18 12:00:31 Re: Sequential vs. random values - number of pages in B-tree
Previous Message pinker 2016-08-18 11:32:12 Sequential vs. random values - number of pages in B-tree