Re: initdb: Refactor PG_CMD_PUTS loops

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: initdb: Refactor PG_CMD_PUTS loops
Date: 2022-12-02 14:07:54
Message-ID: 962a4a82-ec18-6a4f-7002-4edb2a47b94c@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2022-12-01 Th 05:02, Peter Eisentraut wrote:
> 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().  This patch unwinds all that; it's
> much simpler that way.

Looks reasonable. (Most of this dates back to 2003/2004, the very early
days of initdb.c.)

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Israel Barth Rubio 2022-12-02 14:11:28 Re: Add support for DEFAULT specification in COPY FROM
Previous Message Ranier Vilela 2022-12-02 13:35:58 Re: Optimizing Node Files Support