Clean up command argument assembly
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2023-06-26T09:33:28Z
Lists: pgsql-hackers
Attachments
- 0001-Clean-up-command-argument-assembly.patch (text/plain) patch 0001
This is a small code cleanup patch. 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. This patch cleans 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.
Commits
-
Use extensible buffers to assemble command lines
- e70abd67c3e6 17.0 landed
-
Clean up command argument assembly
- cccdbc5d95ac 17.0 landed