0

I'm trying to call PostgreSQL function from windows command line. the Postgres DB located on a Linux VM. I can run the command line but been prompted for password. How can I work around it?

Since the DB is on different VM, I can't modify the pgpass.conf file, it doesn't exist. any other easy way?

1 Answer 1

1

You can run psql on Windows to run a SELECT query that calls the function. To prevent psql from prompting for a password, you can set the password in the PGPASSWORD environment variable.

Optionally, for something which is generally considered somewhat more secure, you could use the pgpass file, which on Windows is located in %APPDATA%\postgresql\pgpass.conf and store the password in there. More details on that can be found here: http://www.postgresql.org/docs/9.3/static/libpq-pgpass.html

Sign up to request clarification or add additional context in comments.

1 Comment

Cool. Since it appears to have solved your issue, please accept my answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.