diff options
author | Nathan Bossart <nathan@postgresql.org> | 2025-02-04 13:26:57 -0600 |
---|---|---|
committer | Nathan Bossart <nathan@postgresql.org> | 2025-02-04 13:26:57 -0600 |
commit | 8c2dd212d1bcefa8d2cbcbe53398de367c2d5f63 (patch) | |
tree | b3be00d257f59e0c2171ebfceb62159db00dbc02 /src/bin/scripts | |
parent | 061994fb31480e65c30f8747e8dcc55935174f4a (diff) | |
download | postgresql-8c2dd212d1bcefa8d2cbcbe53398de367c2d5f63.tar.gz postgresql-8c2dd212d1bcefa8d2cbcbe53398de367c2d5f63.zip |
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 <daniel@yesql.se>
Discussion: https://postgr.es/m/Z6JAwqN1I8ljTuXp%40nathan
Backpatch-through: 13
Diffstat (limited to 'src/bin/scripts')
-rw-r--r-- | src/bin/scripts/vacuumdb.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c index a4039213e9f..cc43141f0a0 100644 --- a/src/bin/scripts/vacuumdb.c +++ b/src/bin/scripts/vacuumdb.c @@ -461,16 +461,25 @@ vacuum_one_database(ConnParams *cparams, } if (vacopts->min_xid_age != 0 && PQserverVersion(conn) < 90600) + { + PQfinish(conn); pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s", "--min-xid-age", "9.6"); + } if (vacopts->min_mxid_age != 0 && PQserverVersion(conn) < 90600) + { + PQfinish(conn); pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s", "--min-mxid-age", "9.6"); + } if (vacopts->parallel_workers >= 0 && PQserverVersion(conn) < 130000) + { + PQfinish(conn); pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s", "--parallel", "13"); + } if (!quiet) { |