Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tfLpI-001i6T-Rx for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Feb 2025 16:31:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tfLpH-005J9O-UB for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Feb 2025 16:31:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tfLpH-005J8v-I9 for pgsql-hackers@lists.postgresql.org; Tue, 04 Feb 2025 16:31:03 +0000 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tfLpF-0039Zl-10 for pgsql-hackers@postgresql.org; Tue, 04 Feb 2025 16:31:02 +0000 Received: by mail-il1-x12c.google.com with SMTP id e9e14a558f8ab-3d04d655fefso1353415ab.3 for ; Tue, 04 Feb 2025 08:31:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738686661; x=1739291461; darn=postgresql.org; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=ftsjfROcqS6o4RPE7QsALA69csG4pUapORVWID1hfm0=; b=OfA/21SojLrEKzNQyW0B14HBVr6S8Rn9VWFgRryo7bRachjS+K35FC7D8+wzTApvEs m9exnm6aj9iDypVnl2Zm+61+3l1V0dJhxM9FT1iagMoVK40o5uvteTvIUEV14hLXza4E uGIL2JKa7RzmgSRXJn4LJ8hr8OeeCCGqVYw8MNoPyhka13hM3BC0dcSPMz7JWplhpLYC UxD3hcXhSS9BF1wuwU2sMnuBr3I4OpLANSNt0m7KT9Fgu0zsptNEDu7oe3MGAe5HZnWF 9IgSjvIC4OqibGnhE+Wzek4LcaSsfJeq/s/QbZvI2CE96g0t/rW01Apm5fuG+tUqSVFl YOZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738686661; x=1739291461; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ftsjfROcqS6o4RPE7QsALA69csG4pUapORVWID1hfm0=; b=vtKmyZuGgTpTWrqIOCQRTtgyJIl6cewDt/MWsVwRs0Ybe4gB1p8z69QzkUSSypgarN UelHDLzeE6K1UbFowRUOynsHyNicIGCy1DuQvtM1EoT/O53etFBfVnsKlTY0a5FX7HgN u9V0CEdzJr6YE9sozEfU7BlqxQdMGPgAaVyG9vIkrxjVOuBxA5PFdGsoRDEhJvDvvVmJ Wonfe1GTAcY76i6cVW3ZEIM5mC/xVuJwtuj4utic8F9A1sMKY1d1LyFSqhtwsvASzWzE W+sx+nuu2zSsAGsAQbUSYhmjLM85fjPMcSb6HaTmHgOziYPkUteFlDFj8EdcpmadeYP0 +L4g== X-Gm-Message-State: AOJu0YyifdYSXe4HfV/YW3iHqQf/ObNq4cGXlT1GVWWsaMXsfbFLBWwc iV0Zf5GlS+jkn5L/jUHyjIt9TmKlj+rZUipcjcAyf4L3IFW44iNjxiC/PQ== X-Gm-Gg: ASbGnctRvGFXlnyEjabzTvdLxTuAmSTUw88hCK4jbKk96VEEtbucN52Zg+jw5tizRjl zhAzTIq0gnHO+uoMdovbu1U3HEc941SoeOMo9y99CKp1sPRqclvyCgfxJ18Y2565bKyq38zKXZ7 XcEPMI9kKtVyN3iNtjBCWmV7/tH3CN1dhaNahRxvx8262wXaLwZ2AKGlZBZ4T8+tkiUAF0RUTb7 9LhTdI0AMZwNimL3i7hDforA2jn2vVdAvtPNE5lSp6Ub4ie9Oqy+2pTXcnTqaYJriGhHI97vXQv YfOD2EAbhnrZ5JGkOwIWtE12Sj6PWOphWAzWcsam/SsbFT8Ig0CCCnnZS/FXJH01eCHEYb7t/Iv nsxQVBg== X-Google-Smtp-Source: AGHT+IHDKehdvuq73hQRMrpgKRXKkGpjUBNmjCBuomaggZzgmuHFVku2K+pBQEit8lDTlgym2HK+OA== X-Received: by 2002:a05:6e02:3609:b0:3d0:e52:7d33 with SMTP id e9e14a558f8ab-3d00e527dbcmr155781135ab.22.1738686660430; Tue, 04 Feb 2025 08:31:00 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3d013605634sm25526725ab.44.2025.02.04.08.30.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2025 08:30:59 -0800 (PST) Date: Tue, 4 Feb 2025 10:30:58 -0600 From: Nathan Bossart To: pgsql-hackers@postgresql.org Subject: add missing PQfinish() calls to vacuumdb Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="WvDLlbv9JbquX+BE" Content-Disposition: inline List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --WvDLlbv9JbquX+BE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I noticed that vacuum_one_database() doesn't call PQfinish() before pg_fatal() in a few of the server version checks. I seem to have unintentionally established this precedent in commit 00d1e88. Michael claimed to have fixed it before committing [0], but that seems to have been missed, too. I don't think this is a huge problem, but it does seem nicer to properly close the connection before exiting. If there are no objections, I plan to commit and back-patch the attached patch shortly. [0] https://postgr.es/m/20190108020300.GH22498%40paquier.xyz -- nathan --WvDLlbv9JbquX+BE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v1-0001-vacuumdb-Add-missing-PQfinish-calls-to-vacuum_one.patch" From be653f97707929e6b7767dc41b34c14c8b9a798b Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Tue, 4 Feb 2025 10:24:09 -0600 Subject: [PATCH v1 1/1] vacuumdb: Add missing PQfinish() calls to vacuum_one_database(). --- src/bin/scripts/vacuumdb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c index 3dc428674ae..74fbc7ef033 100644 --- a/src/bin/scripts/vacuumdb.c +++ b/src/bin/scripts/vacuumdb.c @@ -557,20 +557,32 @@ vacuum_one_database(ConnParams *cparams, } 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", "--min-xid-age", "9.6"); + } 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", "--min-mxid-age", "9.6"); + } if (vacopts->parallel_workers >= 0 && PQserverVersion(conn) < 130000) + { + PQfinish(conn); pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s", "--parallel", "13"); + } if (vacopts->buffer_usage_limit && PQserverVersion(conn) < 160000) + { + PQfinish(conn); pg_fatal("cannot use the \"%s\" option on server versions older than PostgreSQL %s", "--buffer-usage-limit", "16"); + } /* skip_database_stats is used automatically if server supports it */ vacopts->skip_database_stats = (PQserverVersion(conn) >= 160000); -- 2.39.5 (Apple Git-154) --WvDLlbv9JbquX+BE--