Simplify pg_isready usage

The pg_isready documentation says that it does not need a correct
database name or username to get the server status. In fact, incorrect
values result in the server logging failed connection attempts. As a
result, when we set DB_NAME to ALL, calls to the check_availability
function (which uses pg_isready) cause the server to log the following
error:

    FATAL:  database "ALL" does not exist

To eliminate this error, this change simplifies the pg_isready call.
This commit is contained in:
Igor Artemenko
2023-03-20 22:51:05 +00:00
parent 366c4759a5
commit 88fe0d6411

View File

@@ -437,8 +437,7 @@ check_availability() {
;;
"pgsql" )
counter=0
export PGPASSWORD=${DB_PASS}
until pg_isready --dbname=${DB_NAME} --host=${DB_HOST} --port=${DB_PORT} --username=${DB_USER} -q
until pg_isready --host=${DB_HOST} --port=${DB_PORT} -q
do
sleep 5
(( counter+=5 ))