dropdb utility command prompts for password despite valid .pgpass file in home directory

Поиск
Список
Период
Сортировка
От Alan Lin
Тема dropdb utility command prompts for password despite valid .pgpass file in home directory
Дата
Msg-id CAHX75vqgnHFU5i39Qikv6U0sM-+h90dd2KBYEW+qbWCVM9SkOg@mail.gmail.com
обсуждение исходный текст
Ответы Re: dropdb utility command prompts for password despite valid .pgpass file in home directory
Список pgsql-bugs
Problem:

I'm trying to use the dropdb utility command in non-interactive mode to drop an existing database (with active connections) in a test environment, but it keeps prompting me for the password.

Here's what I'm running with `.pgpass` with valid permissions (0600) and location (users home directory, though I've also explicitly set the path using PGPASSFILE envvar). This pass file was validated to work with other utility commands like pg_dump.

Note: "myserverhost" is not a real host - I've just redacted our actual hostname for this bug report.

Command:

```
dropdb --host <myserverhost.amazonaws.com> -w <mydbname>
```

Response:

```
dropdb: error: could not connect to database template1: connection to server at "<myserverhost.amazonaws.com>" (<redacted IP>), port 5432 failed: fe_sendauth: no password supplied
```

Note the `template1` error despite me passing the correct database name.

To confirm that nothing is wrong with my `.pgpass` file, I ran `pg_dump` and `pg_restore` and they ran fine (without any assistance of envvars like PGPASSWORD). `dropdb` also seems to work fine if I provide an explicit password through the environment.

What I expect to happen:

The command should read from my valid `.pgpass` file and drop the database

Thank you.

Additional Information

Postgres Version:

psql (PostgreSQL) 13.7 (Debian 13.7-1.pgdg100+1)

System Information

On a AWS Ubuntu VM

Output of `lscpu`

Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
Address sizes:       48 bits physical, 48 bits virtual
CPU(s):              2
On-line CPU(s) list: 0,1
Thread(s) per core:  2
Core(s) per socket:  1
Socket(s):           1
NUMA node(s):        1
Vendor ID:           AuthenticAMD
CPU family:          23
Model:               1
Model name:          AMD EPYC 7571
Stepping:            2
CPU MHz:             2199.998
BogoMIPS:            4399.99
Hypervisor vendor:   KVM
Virtualization type: full
L1d cache:           32K
L1i cache:           64K
L2 cache:            512K
L3 cache:            8192K

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

Предыдущее
От: Kevin Wolf
Дата:
Сообщение: Re: BUG #17529: SQL Error [57P01]: FATAL: terminating connection due to administrator command
Следующее
От: Jeff Janes
Дата:
Сообщение: Re: BUG #17529: SQL Error [57P01]: FATAL: terminating connection due to administrator command