Re: psql and pgpass.conf on Windows

Поиск
Список
Период
Сортировка
От Julien Rouhaud
Тема Re: psql and pgpass.conf on Windows
Дата
Msg-id 20230630031636.jot6q5v77dlinlro@jrouhaud
обсуждение исходный текст
Ответ на psql and pgpass.conf on Windows  (pf@pfortin.com)
Ответы Re: psql and pgpass.conf on Windows
Список pgsql-general
Hi,

On Thu, Jun 29, 2023 at 10:42:00PM -0400, pf@pfortin.com wrote:
>
> Windows: %APPDATA%\postgresql\pgpass.conf
>
> On Linux, this works.  However, on Windows, psql will not read
> pgpass.conf (tried in just about every location I could think of)
>
> Even:   "set PGPASSFILE=<path to file>" does not work.
>
> Finally, out of frustration, tried:
>   set PGPASSWORD=<password>
> and that got me past the password issue, only to now get:
>     'more' is not recognized as an internal or external command,
>     operable program or batch file.
>
> Given the number of queries about pgpass.conf and finding no answer that
> works, is there no bug report on this?
>
> Thinking that psql was not adjusted for Windows, tried naming the file:
>   .pgpass
>   .pgpass.conf
> also in various locations to no avail...
> What am I (and all the others found in searches) missing? Or are there
> unresolved bugs in psql?
>    - pgpass.conf
>    - expecting external executable: 'more'

The file should indeed be by default %APPDATA%/postgresql/pgpass.conf, and it's
known to be functional on Windows.

The fact that you hit some error with a "more" program makes me think that your
script setup some environment variables (like PAGER=more, which would explain
why you hit that error) that maybe interfere with file location and/or name.

Now, since setting PGPASSFILE also doesn't work I start to wonder if there's
another problem.  Does the password (or any other field) contain some non-ASCII
characters?  There could be an encoding issue in the file, or maybe the problem
is with the presence or absence of a BOM in the file.  Another thing you should
try just in case is to replace backwards slashes with forward slashes.

If none of that work, you could also check what file psql is trying to open
using the equivalent of "strace" for Windows, if such a thing exists.



В списке pgsql-general по дате отправления:

Предыдущее
От: pf@pfortin.com
Дата:
Сообщение: psql and pgpass.conf on Windows
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: psql and pgpass.conf on Windows