1

1) The pgpass.conf (of PostgreSQL) is:

localhost:5432:*:postgres:mypassword

I have no experience with batch and I have spent the day searching in the net.
I'm using Windows - if that matters.

2) I tried with a file.bat as:

cd C:
start "" "C:\Program Files\PostgreSQL\9.4\bin\psql.exe" "C:\Users\utente\Desktop\1Giswater impNode.sql"
pause
start "" "C:\Program Files\PostgreSQL\9.4\bin\psql.exe" "C:\Users\utente\Desktop\2Giswater impArc.sql"
pause
start "" "C:\Program Files\PostgreSQL\9.4\bin\psql.exe" "C:\Users\utente\Desktop\3assegnazione enet.sql"
pause

After typing my password the result is:

psql: fe_sendauth: no password supplied

3) I've written a simple file.bat, which is:

cd C:\Program Files\PostgreSQL\9.4\bin\
pause
rem psql --help
pause
psql   -e -a -f="C:\Users\utente\Desktop\1Giswater impNode.sql"   -d=postgres  -U=postgres

The result is:

psql: opzione di connessione errata

What am I missing?

  • Where exactly is pgpass.conf located? Does it work if you start psql manually? – a_horse_with_no_name Aug 18 '15 at 14:06
  • the path is: C:\Users\utente\AppData\Roaming\postgresql\pgpass.conf – Sandra Aug 18 '15 at 14:23
  • Manually I launch the psql.exe then insert the passwaord but it says: psql: FATALE: autenticazione con password fallita per l'utente "utente" where "utente" is the pc user – Sandra Aug 18 '15 at 14:24
3

You are passing the username incorrectly:

The "short" parameter names don't use the = sign:

So it should either be:

psql -e -a -f"C:\Users\utente\Desktop\1Giswater impNode.sql" -dpostgres  -Upostgres

or, when using the long parameter names:

psql -e -a --file="C:\Users\utente\Desktop\1Giswater impNode.sql" --dbname=postgres  --username=postgres

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.