pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Schenk, Hendrik <hendrik.schenk@sieb-meyer.de>
To: Shreeyansh Dba <shreeyansh2014@gmail.com>
Cc: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: AW: Batch: DB password with ">"
Date: Fri, 12 Oct 2018 05:57:06 +0000
Message-ID: <68ad40c37ef54e65baa874325ecad124@sieb-meyer.de> (raw)
In-Reply-To: <CAGDYbUMhAo3vu8Bk4r=2QGwCXRZHbkGCPYZBJyF+nV_AtzMfFw@mail.gmail.com>
References: <5a251002104944a2955bdf4dbaea3a42@sieb-meyer.de>
	<CAGDYbUMhAo3vu8Bk4r=2QGwCXRZHbkGCPYZBJyF+nV_AtzMfFw@mail.gmail.com>

There was a space too much between the password and the streaming operator. So the password was extended by a trailing space.
Furthermore you have to escape the >-symbol first with the carret in the windows command shell and then the escape-symbol \ for psql.


echo localhost:5432:postgres:postgres: 7Ug\^>uAks!{VA> %PGPASSFILE%


best regards
Hendrik

Von: Shreeyansh Dba <shreeyansh2014@gmail.com>
Gesendet: Donnerstag, 11. Oktober 2018 17:17
An: Schenk, Hendrik <hendrik.schenk@sieb-meyer.de>
Cc: pgsql-admin@lists.postgresql.org
Betreff: Re: Batch: DB password with ">"

Hi,

You can use below command to get the desired output.

echo localhost:5432:postgres:postgres:7Ug^\>uAks!{VA > %PGPASSFILE%
                                                 or
echo "localhost:5432:postgres:postgres:7Ug^>uAks!{VA" > %PGPASSFILE%

[Das Bild wurde vom Absender entfernt.]<http://www.shreeyansh.com;


On Thu, Oct 11, 2018 at 6:38 PM Schenk, Hendrik <hendrik.schenk@sieb-meyer.de<mailto:hendrik.schenk@sieb-meyer.de>> wrote:
Hi,

i want to modiy the adatabse via batch script. The user has a password that contains symbols like that “g>uAks!”. The problem here is the “greater than”-symbol.

call set PGPASSFILE=%TEMP%\pgpass.conf
echo localhost:5432:postgres:postgres:7Ug^>uAks!{VA > %PGPASSFILE%

"C:\Program Files\PostgreSQL\10\bin\psql" -U postgres

psql will always fail with FATAL: User-Athentification failed. The password was read from ..\Local\Temp\pgpass.conf




If I set a Enviromentvariable and “echo” it, it will not work, because of the >-symbol.


C:\Users\hschenk>set PGPASSWORD=lalal>lala

C:\Users\hschenk>echo %PGPASSWORD%
Lalal

How can I use this with a password like this?


Attachments:

image001.jpg (image/jpeg, 632B) download view image

view thread (2+ messages)

Message-ID: <68ad40c37ef54e65baa874325ecad124@sieb-meyer.de>
Permalink:  ../68ad40c37ef54e65baa874325ecad124@sieb-meyer.de/
Also on:    postgresql.org/message-id/68ad40c37ef54e65baa874325ecad124@sieb-meyer.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: hendrik.schenk@sieb-meyer.de, shreeyansh2014@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: AW: Batch: DB password with ">"
  In-Reply-To: <68ad40c37ef54e65baa874325ecad124@sieb-meyer.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox