Skip to content

Commit 8703cde

Browse files
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 00d1e88, 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
1 parent 2548349 commit 8703cde

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/bin/scripts/vacuumdb.c

+12
Original file line numberDiff line numberDiff line change
@@ -558,20 +558,32 @@ vacuum_one_database(ConnParams *cparams,
558558
}
559559

560560
if (vacopts->min_xid_age != 0 && PQserverVersion(conn) < 90600)
561+
{
562+
PQfinish(conn);
561563
pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
562564
"--min-xid-age", "9.6");
565+
}
563566

564567
if (vacopts->min_mxid_age != 0 && PQserverVersion(conn) < 90600)
568+
{
569+
PQfinish(conn);
565570
pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
566571
"--min-mxid-age", "9.6");
572+
}
567573

568574
if (vacopts->parallel_workers >= 0 && PQserverVersion(conn) < 130000)
575+
{
576+
PQfinish(conn);
569577
pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
570578
"--parallel", "13");
579+
}
571580

572581
if (vacopts->buffer_usage_limit && PQserverVersion(conn) < 160000)
582+
{
583+
PQfinish(conn);
573584
pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
574585
"--buffer-usage-limit", "16");
586+
}
575587

576588
/* skip_database_stats is used automatically if server supports it */
577589
vacopts->skip_database_stats = (PQserverVersion(conn) >= 160000);

0 commit comments

Comments
 (0)