pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hunosau, Aliaksei <ahunosau@scnsoft.com>
To: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: pg_isready bug
Date: Mon, 13 Apr 2020 12:53:32 +0000
Message-ID: <1586782412339.75897@scnsoft.com> (raw)

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,


[https://www.scnsoft.com/website/var/assets/logos/logo-64x64.png]<http://www.scnsoft.com/;


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<mailto:ahunosau@scnsoft.com>
www.scnsoft.com<https://www.scnsoft.com/?utm_source=EmailSignature&utm_medium=email&utm_campaign=GeneralEmai...; | LinkedIn<https://www.linkedin.com/company/sciencesoft?trk=srch_hero_comp_name; | Facebook<https://www.facebook.com/sciencesoft.solutions; | Twitter<https://twitter.com/ScienceSoft;

view thread (3+ messages)  latest in thread

Message-ID: <1586782412339.75897@scnsoft.com>
Permalink:  ../1586782412339.75897@scnsoft.com/
Also on:    postgresql.org/message-id/1586782412339.75897@scnsoft.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: ahunosau@scnsoft.com
  Subject: Re: pg_isready bug
  In-Reply-To: <1586782412339.75897@scnsoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox