pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: initdb: Refactor PG_CMD_PUTS loops
Date: Mon, 05 Dec 2022 22:40:17 +0000
Message-ID: <E1p2K8G-0029iG-SO@gemulon.postgresql.org> (raw)

initdb: Refactor PG_CMD_PUTS loops

Keeping the SQL commands that initdb runs in string arrays before
feeding them to PG_CMD_PUTS() seems unnecessarily verbose and
inflexible.  In some cases, the array only has one member.  In other
cases, one might want to use PG_CMD_PRINTF() instead, to parametrize a
command, but that would require breaking up the loop or using
workarounds like replace_token().  Unwind all that; it's much simpler
that way.

Reviewed-by: John Naylor <john.naylor@enterprisedb.com>
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Discussion: https://www.postgresql.org/message-id/flat/2c50823b-f453-bb97-e38b-34751c51dcdf%40enterprisedb.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1bd47d0dca9f63dc26abc00d4912857440cd101c

Modified Files
--------------
src/bin/initdb/initdb.c | 379 ++++++++++++++++++++++--------------------------
1 file changed, 170 insertions(+), 209 deletions(-)



Message-ID: <E1p2K8G-0029iG-SO@gemulon.postgresql.org>
Permalink:  ../E1p2K8G-0029iG-SO@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1p2K8G-0029iG-SO@gemulon.postgresql.org

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org
  Subject: Re: pgsql: initdb: Refactor PG_CMD_PUTS loops
  In-Reply-To: <E1p2K8G-0029iG-SO@gemulon.postgresql.org>
  References: <E1p2K8G-0029iG-SO@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