From: Nathan Bossart Date: Tue, 4 Feb 2025 19:26:57 +0000 (-0600) Subject: vacuumdb: Add missing PQfinish() calls to vacuum_one_database(). X-Git-Tag: REL_13_19~16 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=d6ea82f5da181eb4278595d7dca601568deeed5e;p=postgresql.git vacuumdb: Add missing PQfinish() calls to vacuum_one_database(). A few of the version checks in vacuum_one_database() do not call PQfinish() before exiting. This precedent was unintentionally established in commit 00d1e88d36, and while it's probably not too problematic, it seems better to properly close the connection. Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/Z6JAwqN1I8ljTuXp%40nathan Backpatch-through: 13 --- diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c index 57db0ecc5c0..a46fb7133b7 100644 --- a/src/bin/scripts/vacuumdb.c +++ b/src/bin/scripts/vacuumdb.c @@ -424,6 +424,7 @@ vacuum_one_database(const ConnParams *cparams, if (vacopts->min_xid_age != 0 && PQserverVersion(conn) < 90600) { + PQfinish(conn); pg_log_error("cannot use the \"%s\" option on server versions older than PostgreSQL %s", "--min-xid-age", "9.6"); exit(1); @@ -431,6 +432,7 @@ vacuum_one_database(const ConnParams *cparams, if (vacopts->min_mxid_age != 0 && PQserverVersion(conn) < 90600) { + PQfinish(conn); pg_log_error("cannot use the \"%s\" option on server versions older than PostgreSQL %s", "--min-mxid-age", "9.6"); exit(1); @@ -438,6 +440,7 @@ vacuum_one_database(const ConnParams *cparams, if (vacopts->parallel_workers >= 0 && PQserverVersion(conn) < 130000) { + PQfinish(conn); pg_log_error("cannot use the \"%s\" option on server versions older than PostgreSQL %s", "--parallel", "13"); exit(1);