Skip to content

Commit f3e4aeb

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 cc2c9fa commit f3e4aeb

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
@@ -557,20 +557,32 @@ vacuum_one_database(ConnParams *cparams,
557557
}
558558

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

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

567573
if (vacopts->parallel_workers >= 0 && PQserverVersion(conn) < 130000)
574+
{
575+
PQfinish(conn);
568576
pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
569577
"--parallel", "13");
578+
}
570579

571580
if (vacopts->buffer_usage_limit && PQserverVersion(conn) < 160000)
581+
{
582+
PQfinish(conn);
572583
pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
573584
"--buffer-usage-limit", "16");
585+
}
574586

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

0 commit comments

Comments
 (0)