Clean up command argument assembly

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Clean up command argument assembly
Date: 2023-06-26 09:33:28
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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.

Attachment Content-Type Size
0001-Clean-up-command-argument-assembly.patch text/plain 8.0 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2023-06-26 09:36:56 pg_decode_message vs skip_empty_xacts and xact_wrote_changes
Previous Message Andrey Lepikhov 2023-06-26 09:22:03 Re: Problems with estimating OR conditions, IS NULL on LEFT JOINs