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
This commit is contained in:
parent
f07ebd54a3
commit
e8d8174caf
@ -568,20 +568,32 @@ vacuum_one_database(ConnParams *cparams,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vacopts->min_xid_age != 0 && PQserverVersion(conn) < 90600)
|
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",
|
pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
|
||||||
"--min-xid-age", "9.6");
|
"--min-xid-age", "9.6");
|
||||||
|
}
|
||||||
|
|
||||||
if (vacopts->min_mxid_age != 0 && PQserverVersion(conn) < 90600)
|
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",
|
pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
|
||||||
"--min-mxid-age", "9.6");
|
"--min-mxid-age", "9.6");
|
||||||
|
}
|
||||||
|
|
||||||
if (vacopts->parallel_workers >= 0 && PQserverVersion(conn) < 130000)
|
if (vacopts->parallel_workers >= 0 && PQserverVersion(conn) < 130000)
|
||||||
|
{
|
||||||
|
PQfinish(conn);
|
||||||
pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
|
pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
|
||||||
"--parallel", "13");
|
"--parallel", "13");
|
||||||
|
}
|
||||||
|
|
||||||
if (vacopts->buffer_usage_limit && PQserverVersion(conn) < 160000)
|
if (vacopts->buffer_usage_limit && PQserverVersion(conn) < 160000)
|
||||||
|
{
|
||||||
|
PQfinish(conn);
|
||||||
pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
|
pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
|
||||||
"--buffer-usage-limit", "16");
|
"--buffer-usage-limit", "16");
|
||||||
|
}
|
||||||
|
|
||||||
/* skip_database_stats is used automatically if server supports it */
|
/* skip_database_stats is used automatically if server supports it */
|
||||||
vacopts->skip_database_stats = (PQserverVersion(conn) >= 160000);
|
vacopts->skip_database_stats = (PQserverVersion(conn) >= 160000);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user