Skip to content

Commit e8d8174

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 f07ebd5 commit e8d8174

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/bin/scripts/vacuumdb.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,20 +568,32 @@ vacuum_one_database(ConnParams *cparams,
568568
}
569569

570570
if (vacopts->min_xid_age != 0 && PQserverVersion(conn) < 90600)
571+
{
572+
PQfinish(conn);
571573
pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
572574
"--min-xid-age", "9.6");
575+
}
573576

574577
if (vacopts->min_mxid_age != 0 && PQserverVersion(conn) < 90600)
578+
{
579+
PQfinish(conn);
575580
pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
576581
"--min-mxid-age", "9.6");
582+
}
577583

578584
if (vacopts->parallel_workers >= 0 && PQserverVersion(conn) < 130000)
585+
{
586+
PQfinish(conn);
579587
pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
580588
"--parallel", "13");
589+
}
581590

582591
if (vacopts->buffer_usage_limit && PQserverVersion(conn) < 160000)
592+
{
593+
PQfinish(conn);
583594
pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s",
584595
"--buffer-usage-limit", "16");
596+
}
585597

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy