Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNzEI-0004aG-25 for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Apr 2020 13:34:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jNzEG-0007LX-RP for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Apr 2020 13:34:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNyaw-00024M-Rx for pgsql-bugs@lists.postgresql.org; Mon, 13 Apr 2020 12:53:47 +0000 Received: from mail-eopbgr60080.outbound.protection.outlook.com ([40.107.6.80] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNyao-0005c2-T1 for pgsql-bugs@postgresql.org; Mon, 13 Apr 2020 12:53:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IwVmk/VgNfb2O6Qh9PVmFSKzfTqN+EIszsjaXlXF8/Fd8qM8QVIYt0fzt40vRrFLPLQnPs/x6WeDLkhEbZNxkTlsw4Scdl9ew+3XF2EQJpkfuArL01MzM71RpMz+0SQjl74dbK4vGimqWsGxXijIRpo/MZuwukLQyFfoDEhxX+El3QOWLiRf/drsVvDun0udBhoRSldtUOMJGeYBjuPNzaPZHg87ONROTKMVwBjV+U9n1+ihR9I7+k1nSDZX5EEW6XFfDXDT3hgWJIzHo7hMdM1IzjiQLqGUoevYgYnKrGWhhXNstiGZV/cxsgN7zPgijVfTh8tNKuGVTTFnhBxKVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DCJAWRP2Qi7iE+6Z9Oy6K6ibkzAaeFsA0BByxTbJ3TA=; b=V7ipYbggSqydacq/hSzJB8UxU702KnpAVwqeox1ftklAvNi0LQOdmT1MOtUraAyx1kFTnfSQ6DWU4Y/uLkjzggpp0p7MMqNGQOoSd0DB6Sw6rHqJLWNIbhcqv0XurSRgLYf3c+VFPGKVnTJMKxvOFPUSCgxh7t7e5JOwGEabacXFgCLz6p+7p6dfe5s5IQJwLowo+N/YbxBNHR1PWTTxJ+6hcBd7V/YyMnDdLV7JWyY2yJ4DqQghAwqAeRTynOlAOEzoZPSlakg8eKYWNO3IcJm1fx+duaduC6gYzZohAz1ZjAqVDFIFVxCe+tlv7bifsRb6/E3yCZ9kaYh4FffNdw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 93.171.207.9) smtp.rcpttodomain=postgresql.org smtp.mailfrom=scnsoft.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=scnsoft.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scnsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DCJAWRP2Qi7iE+6Z9Oy6K6ibkzAaeFsA0BByxTbJ3TA=; b=nZL69vSUYNON9qWFfMr3eUnqMZ6GbYVBsxArulukFy7VEpZF/vX9SqkCkoR0neffnrpXo6DJ52Pq654/Mz8c4Tsfvz3lpDdieQzff+DRWm3IV1Vl//6xV78HdPADkDFhJ2RBRVAGLsoXNXNlGb1fSanXion02ZFWcnvDgT7GdNw= Received: from DB6PR0301CA0007.eurprd03.prod.outlook.com (2603:10a6:4:3e::17) by PR3PR10MB3883.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:40::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.17; Mon, 13 Apr 2020 12:53:35 +0000 Received: from DB5EUR01FT045.eop-EUR01.prod.protection.outlook.com (2603:10a6:4:3e:cafe::9e) by DB6PR0301CA0007.outlook.office365.com (2603:10a6:4:3e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.15 via Frontend Transport; Mon, 13 Apr 2020 12:53:35 +0000 Authentication-Results: spf=pass (sender IP is 93.171.207.9) smtp.mailfrom=scnsoft.com; postgresql.org; dkim=none (message not signed) header.d=none;postgresql.org; dmarc=pass action=none header.from=scnsoft.com; Received-SPF: Pass (protection.outlook.com: domain of scnsoft.com designates 93.171.207.9 as permitted sender) receiver=protection.outlook.com; client-ip=93.171.207.9; helo=mail.scnsoft.com; Received: from mail.scnsoft.com (93.171.207.9) by DB5EUR01FT045.mail.protection.outlook.com (10.152.4.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2900.15 via Frontend Transport; Mon, 13 Apr 2020 12:53:34 +0000 Received: from SRV-SCN-MBX1.scnsoft.com (10.20.1.83) by srv-scn-mbx1.scnsoft.com (10.20.1.83) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 13 Apr 2020 15:53:33 +0300 Received: from SRV-SCN-MBX1.scnsoft.com ([fe80::149f:1d25:cb51:494e]) by srv-scn-mbx1.scnsoft.com ([fe80::149f:1d25:cb51:494e%19]) with mapi id 15.00.1347.000; Mon, 13 Apr 2020 15:53:33 +0300 From: "Hunosau, Aliaksei" To: "pgsql-bugs@postgresql.org" Subject: pg_isready bug Thread-Topic: pg_isready bug Thread-Index: AQHWEZJq1zmMgYMacUmE5MHuvG/9Vw== Date: Mon, 13 Apr 2020 12:53:32 +0000 Message-ID: <1586782412339.75897@scnsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [178.121.68.100] Content-Type: multipart/alternative; boundary="_000_158678241233975897scnsoftcom_" MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:93.171.207.9;CTRY:BY;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.scnsoft.com;PTR:ErrorRetry;CAT:NONE;SFTY:;SFS:(10009020)(396003)(346002)(136003)(376002)(39840400004)(46966005)(316002)(356005)(2616005)(6916009)(81166007)(5660300002)(47076004)(15974865002)(2906002)(70206006)(45080400002)(186003)(70586007)(8676002)(36756003)(336012)(26005)(7696005)(19627405001)(7116003)(8936002)(426003)(81156014)(508600001)(86362001);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fc105b93-1b46-4561-d4d7-08d7dfa9ad11 X-MS-TrafficTypeDiagnostic: PR3PR10MB3883: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 037291602B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oUiagdL1zARLBgU5xdrYR0FTZkSa3R0suerid7iGnL5Nex2eyfduWqHBn5MkSqvRDeFXgiTBMqv3rg8CIt8Lk4O1BxXk/eAxsnhjgX1qxm4tJMBbL+UROmWk/58iN8I3u8YJGXU94QD0miIRCOYrxEKRNQZdSHI9X2Nf4UhVDe1Oq4xJFbqUCQ3xti9tWuOe/dcCjNLlcFmk/+RIhUU5f8Eh0TL/PaCNoTTKegf5DRvYhpG+fyCt9fqdiTCgYYxsOkVdSbXPKn6ZzDBEzTcWPCRPlch5h6n8W061YLXhAFz1c3Q/LMfTyG58luvjUO+a96+i/bQOHVLCit0MbN/E2DMFySl0xDKLzEK6fm/sCUO2BMAWiQqMoSgnumdNrKkJz7Uvk7uY/HUv+//w8TZWD8OOsZxSXVyHGy0qSzfKHKKFCLD+jtsBqvnGAT/xtKFoTGVIqdvqK98cc6uqdb/IFovzu+P2x11V5i4JrEsAL6sDXF3oJp7KrQr58t2iMThjdWg9mXJV2E+ueuTagCenyTdI2oqFgJ5jO3+4XXRx6McH8A1mDClqfFdkx9GOkOSt/35nuvxr2vv+7C7iBj+RkQ== X-OriginatorOrg: scnsoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2020 12:53:34.0659 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fc105b93-1b46-4561-d4d7-08d7dfa9ad11 X-MS-Exchange-CrossTenant-Id: 73e2d4c4-aed9-4e34-924b-f5449c11a2d6 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=73e2d4c4-aed9-4e34-924b-f5449c11a2d6;Ip=[93.171.207.9];Helo=[mail.scnsoft.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR10MB3883 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --_000_158678241233975897scnsoftcom_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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=3D# \l+ List of = databases Name | Owner | Encoding | Collate | Ctype | Access privi= leges | 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 | =3Dc/postgres = +| 7529 kB | pg_default | unmodifiable empty database | | | | | postgres=3DCTc= /postgres | | | template1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | =3Dc/postgres = +| 7529 kB | pg_default | default template for new databases | | | | | postgres=3DCTc= /postgres | | | (4 rows) postgres=3D# 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 postgre= s # 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 s= ame. It will be better to exit with non null exitcode if pg_isready can't connec= t to absent db or using incorrect user. Best regards, [https://www.scnsoft.com/website/var/assets/logos/logo-64x64.png] 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 --_000_158678241233975897scnsoftcom_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
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=3D# \l+
                    =                      = ;                     &nb= sp;    List of databases
   Name    |  Owner   | Encoding |  = ;Collate   |   Ctype    |   Access privileges &nbs= p; |  Size   | Tablespace |           &n= bsp;    Description             &nb= sp;   
-----------+----------+----------+------------+-------= -----+-----------------------+---------+------------+------= --------------------------------------
 internal  | postgres | UTF8     | en_US.utf8 | en= _US.utf8 |                   &= nbsp;   | 12 MB   | pg_default | 
 postgres  | postgres | UTF8     | en_US.utf8 | en= _US.utf8 |                   &= nbsp;   | 7669 kB | pg_default | default administrative connection dat= abase
 template0 | postgres | UTF8     | en_US.utf8 | en_US.u= tf8 | =3Dc/postgres          +| 7529 kB | pg_d= efault | unmodifiable empty database
           |        =  |          |         &n= bsp;  |            | postgres=3DCTc/post= gres |         |           &nb= sp;| 
 template1 | postgres | UTF8     | en_US.utf8 | en_US.u= tf8 | =3Dc/postgres          +| 7529 kB | pg_d= efault | default template for new databases
           |        =  |          |         &n= bsp;  |            | postgres=3DCTc/post= gres |         |           &nb= sp;| 
(4 rows)

postgres=3D# exit
root@29243fe45836:/# pg_isready -d 123456 -h localhost -p 5432 -U post= gres # 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 po= stgres # 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 c= onnect to absent db or using incorrect user.



Best regards,
 

Aliaksei Hunosau, DevOps engineer
ScienceSoft - Professional Software D= evelopment
2 Bedy Street, Minsk, Belarus= , 220040
P +375 17 293 37= 36 | F= 3;375 17 293 37 39
ahunosau@scnsoft.com
www.scnsoft.com&nb= sp;| LinkedIn | Facebook=  | Twitter

--_000_158678241233975897scnsoftcom_--