Italo Rodrigo
Italo Rodrigo

Reputation: 1785

SET PGPASSWORD with asterisk character not working

I use a batch file to copy data from a database to other like this:

SET PGPASSWORD=passtest

"C:\Program Files\e-SUS\database\postgresql-9.6.13-4-windows-x64\bin\psql.exe" -h 10.10.10.10 -p 5433 -d esus -U postgres -c "\copy (SELECT * from mytable) to 'e:\data.csv' with csv header"

IF EXIST e:\data.csv ( "C:\Program Files\e-SUS\database\postgresql-9.6.13-4-windows-x64\bin\psql.exe" -h 11.11.11.11 -p 5433 -d esus -U postgres -c "\copy mytable from 'e:\data.csv' with csv header delimiter ','" )

this works correctly, but if my password have a asterisk character like SET PGPASSWORD=pass*test this not works... I try to use SET PGPASSWORD=pass%*test but this not works too.

Any idea?

Upvotes: 1

Views: 880

Answers (2)

Imtiyaz Shaikh
Imtiyaz Shaikh

Reputation: 625

 set "PGPASSWORD=yourpass"

Upvotes: 1

Laurenz Albe
Laurenz Albe

Reputation: 247270

You need to quote the asterisk:

SET PGPASSWORD="sec*ret"

Upvotes: 2

Related Questions