From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Clean up command argument assembly
Date: Wed, 05 Jul 2023 05:21:00 +0000
Message-ID: <E1qGuwn-001yoQ-2M@gemulon.postgresql.org> (raw)
Clean up command argument assembly
Several commands internally assemble command lines to call other
commands. This includes initdb, pg_dumpall, and pg_regress. (Also
pg_ctl, but that is different enough that I didn't consider it here.)
This has all evolved a bit organically, with fixed-size buffers, and
various optional command-line arguments being injected with
confusing-looking code, and the spacing between options handled in
inconsistent ways. Clean all this up a bit to look clearer and be
more easily extensible with new arguments and options. We start each
command with printfPQExpBuffer(), and then append arguments as
necessary with appendPQExpBuffer(). Also standardize on using
initPQExpBuffer() over createPQExpBuffer() where possible. pg_regress
uses StringInfo instead of PQExpBuffer, but many of the same ideas
apply.
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://www.postgresql.org/message-id/flat/16d0beac-a141-e5d3-60e9-323da75f49bf@eisentraut.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/cccdbc5d95aca276789bbe28783f3e06f9a3ba9c
Modified Files
--------------
src/bin/initdb/initdb.c | 56 ++++++++++++++++++++++++-------------------
src/bin/pg_dump/pg_dumpall.c | 27 +++++++++++----------
src/test/regress/pg_regress.c | 26 ++++++++++++--------
3 files changed, 62 insertions(+), 47 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Clean up command argument assembly
In-Reply-To: <E1qGuwn-001yoQ-2M@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox