Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eeaf689

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 <[email protected]> Discussion: https://postgr.es/m/Z6JAwqN1I8ljTuXp%40nathan Backpatch-through: 13
1 parent d7260f9 commit eeaf689

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/bin/scripts/vacuumdb.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,20 +514,23 @@ vacuum_one_database(ConnParams *cparams,
514514

515515
if (vacopts->min_xid_age != 0 && PQserverVersion(conn) < 90600)
516516
{
517+
PQfinish(conn);
517518
pg_log_error("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
518519
"--min-xid-age", "9.6");
519520
exit(1);
520521
}
521522

522523
if (vacopts->min_mxid_age != 0 && PQserverVersion(conn) < 90600)
523524
{
525+
PQfinish(conn);
524526
pg_log_error("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
525527
"--min-mxid-age", "9.6");
526528
exit(1);
527529
}
528530

529531
if (vacopts->parallel_workers >= 0 && PQserverVersion(conn) < 130000)
530532
{
533+
PQfinish(conn);
531534
pg_log_error("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
532535
"--parallel", "13");
533536
exit(1);

0 commit comments

Comments
 (0)