Re: initdb: Refactor PG_CMD_PUTS loops

From: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: initdb: Refactor PG_CMD_PUTS loops
Date: 2022-12-02 07:03:40
Message-ID: CAFBsxsFZpsQds47cJFoVRMrs66QtfLwXzpOn+BxmR2s8hftrUg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 1, 2022 at 5:02 PM Peter Eisentraut <
peter(dot)eisentraut(at)enterprisedb(dot)com> 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.

+1, I can't think of a reason to keep the current coding

--
John Naylor
EDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2022-12-02 07:05:27 Re: Time delayed LR (WAS Re: logical replication restrictions)
Previous Message Bharath Rupireddy 2022-12-02 06:41:35 Re: O(n) tasks cause lengthy startups and checkpoints