pgsql: initdb: Refactor PG_CMD_PUTS loops

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: initdb: Refactor PG_CMD_PUTS loops
Date: 2022-12-05 22:40:17
Message-ID: E1p2K8G-0029iG-SO@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(dot)naylor(at)enterprisedb(dot)com>
Reviewed-by: Andrew Dunstan <andrew(at)dunslane(dot)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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2022-12-06 00:20:46 pgsql: Provide test coverage in pg_dump for default behaviors with comp
Previous Message Tom Lane 2022-12-05 17:36:47 pgsql: Fix Memoize to work with partitionwise joining.