pg_isready bug

Поиск
Список
Период
Сортировка
От Hunosau, Aliaksei
Тема pg_isready bug
Дата
Msg-id 1586782412339.75897@scnsoft.com
обсуждение исходный текст
Ответы Re: pg_isready bug  (Fabien COELHO <coelho@cri.ensmp.fr>)
Список pgsql-bugs
We are using Postgres in docker. And problem with pg_isready​ was found.

Please, look:

root@29243fe45836:/# psql -U postgres
psql (11.6 (Debian 11.6-1.pgdg90+1))
Type "help" for help.

postgres=# \l+
                                                                   List of databases
   Name    |  Owner   | Encoding |  Collate   |   Ctype    |   Access privileges   |  Size   | Tablespace |                Description                 
-----------+----------+----------+------------+------------+-----------------------+---------+------------+--------------------------------------------
 internal  | postgres | UTF8     | en_US.utf8 | en_US.utf8 |                       | 12 MB   | pg_default | 
 postgres  | postgres | UTF8     | en_US.utf8 | en_US.utf8 |                       | 7669 kB | pg_default | default administrative connection database
 template0 | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +| 7529 kB | pg_default | unmodifiable empty database
           |          |          |            |            | postgres=CTc/postgres |         |            | 
 template1 | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +| 7529 kB | pg_default | default template for new databases
           |          |          |            |            | postgres=CTc/postgres |         |            | 
(4 rows)

postgres=# exit
root@29243fe45836:/# pg_isready -d 123456 -h localhost -p 5432 -U postgres # the DB 123456 doesn't exist
localhost:5432 - accepting connections # but it shows all is good
root@29243fe45836:/# echo $?
0
root@29243fe45836:/# pg_isready -d internal -h localhost -p 5432 -U postgres # the DB internal doesn't exist
localhost:5432 - accepting connections # looks good
root@29243fe45836:/# echo $?
0

The exitcodes of pg_isready if the DB doesn't exist and if exists are the same.
It will be better to exit with non null exitcode if pg_isready can't connect to absent db or using incorrect user.



Best regards,
 

Aliaksei Hunosau, DevOps engineer
ScienceSoft - Professional Software Development
2 Bedy Street, Minsk, Belarus, 220040
P +375 17 293 37 36 | F+375 17 293 37 39
ahunosau@scnsoft.com
www.scnsoft.com | LinkedIn | Facebook | Twitter

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

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: backend crash
Следующее
От: Fabien COELHO
Дата:
Сообщение: Re: pg_isready bug