Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vml5P-00FwJU-1w for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Feb 2026 03:58:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vml5N-00BU3l-2N for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Feb 2026 03:58:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vml5N-00BU3Z-1T for pgsql-hackers@lists.postgresql.org; Mon, 02 Feb 2026 03:58:50 +0000 Received: from mail-dy1-x132e.google.com ([2607:f8b0:4864:20::132e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vml5L-00000000bii-3i5c for pgsql-hackers@lists.postgresql.org; Mon, 02 Feb 2026 03:58:50 +0000 Received: by mail-dy1-x132e.google.com with SMTP id 5a478bee46e88-2b71320f501so7225988eec.1 for ; Sun, 01 Feb 2026 19:58:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770004726; x=1770609526; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+THzszYAH1WhTzFxpNF5gW2H2FBmLCq+9LxOOSmdfDw=; b=FD08EauJQqSLRQy9m/354TeF2RFdrGMflthQli9QKno8RmKsTq4RMpTCu1Jg/gQdzc U9oBAvJ3Twwq444wsWVDOe5GNXSzWtftMcUHYUhgqT7jZ890frg9L7Ixg1IxWOX9EjcK ndLbBFQPdRWztHHaVemEKtzVeGenDW0a+7ilx40r+/0ARcgUvN1bHOlkHWNdGtGNGR8c ZfxZ/hm8BSxnCNgtN/iuR7z0Zw0JsCLvgYFvkPexRsjW2AP8IYJVJfTzDwtOF4+keAcH qbQbul2mUbDNApv6B41wn6QDsC/leWU2tO0L0N+dNXo3nqDYwNVzm5tDmDU4JSKm7FWi 8Bzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770004726; x=1770609526; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=+THzszYAH1WhTzFxpNF5gW2H2FBmLCq+9LxOOSmdfDw=; b=WBF/nFhXAnLqKslJs2xVqYq8APpNVYN8mRbLDUGhpgmCV/+OE/i8xSijvuVTEtbSAZ 9oVHcd0rZzWPuK+OzQstk8F/Ce8TmSDm2e71Gg26ux8+MhwdWIDrXIwHGMwn5SEPnMBe HyFDcyesWfTtyxgr4iuRTYWR48ngb3Hz5PZfdNbk5nrQZ4a/PVGz6fDdsk8j12JToU2z YSt2z2S4rx0islgibscFsA4t0Coga1T2rVpMUy1i9myPeH2HTREmuvhJ2y502AaF0KOt jV36JNLzhJH/R/RYGbDkmvPCSKckg9WvrCeYjS5XnhNnBXSLd6z3trQmN4ME5yq32DX8 RrqA== X-Gm-Message-State: AOJu0YxHmErNL8ugjcBWxixK3QV7bGAJ1NgqdSJVohSj3GTI5DSDinA6 QDEIq2ncxuiBaB3t2zKRRhRT0mW/p05PbL9pJFB4Gqk8ji1V7+KKY19DvhrTOtQH X-Gm-Gg: AZuq6aIeIofN6Et90dpReNmu+hgQ1ciO+acEEnboxvmnAU/wJXFp95VJjlfeI22tYMs fI5p3rJz38fu8ISsHRx3o2sYzc7SptyMzDRCAbbQZhEUwbC/4Q9LvusNeTiuXdjK5gw5/RnmjzE 3Xv4HHG1i9jvcsv8ppbqqNZEjPXf5WH6XT2nxug9tbtWeTpnXz5+2uXiJV8rUno31NiuKTLvfFa QCvRekghcf/cnek2+svj+bLBDzs+YT9TkvFdjS0ovWJSHhp+AIAx1JRXNMYjZCXecTX/zMFypKF WcG5Cc19xbnVrkGB08YaNM5yQGcjJ2N1W/tB+jY4KcJ0SO+uyW8qs4eEYOsAOWZ2AmVaVpp1HRv XcPtfvV3B/L/aXz4d/th+FUXTgT2kAIC3gijGNeRZdGTyGmpIL82hEZyKJ3+Xn+xxP5mAvMYBB/ 6g/xtL4UTCzTlVEhw0/BfG X-Received: by 2002:a05:7300:4306:b0:2b7:f7f:69c with SMTP id 5a478bee46e88-2b7c88ec6ddmr4814933eec.32.1770004725829; Sun, 01 Feb 2026 19:58:45 -0800 (PST) Received: from smtpclient.apple ([142.171.105.12]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b7a16cf8f2sm20885137eec.7.2026.02.01.19.58.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Feb 2026 19:58:45 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.300.41.1.7\)) Subject: Re: splitting pg_resetwal output strings From: Chao Li In-Reply-To: <202601311502.ohp4cx7hfms2@alvherre.pgsql> Date: Mon, 2 Feb 2026 11:58:10 +0800 Cc: Pg Hackers Content-Transfer-Encoding: quoted-printable Message-Id: References: <202601311502.ohp4cx7hfms2@alvherre.pgsql> To: =?utf-8?Q?=C3=81lvaro_Herrera?= X-Mailer: Apple Mail (2.3864.300.41.1.7) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Jan 31, 2026, at 23:08, =C3=81lvaro Herrera = wrote: >=20 > On 2026-Jan-31, =C3=81lvaro Herrera wrote: >=20 >> This is not complete. It modifies PrintControlValues(), which is = easy >> because I just print each item in the entries.h file in the same = order >> they appear there. But for PrintNewControlValues() I'll need to add = a >> symbolic identifier to each string, that the code can use to scan the >> array and print just those elements. I'll do that if there are no >> objections to this idea here. >=20 > It looks more or less like this. Patch 0001 is the same as before, = and > 0002 adds the symbolic names, which is used to create an enum and then > to search for the correct lines to print in PrintNewControlValues. >=20 > I decided to reuse simple_oid_list to store the integers values, which > is kinda icky, so getting to something committable I think would have = me > add simple_int_list. Also, there's a few blocks that are duplicate > cases of the same line measuring and printing logic; I suppose I = should > have a routine to simplify. >=20 Hi Alvaro, I don't think we necessarily need to add a simple_int_list. Since OIDs = are not globally unique across all object types, we can reasonably treat = ControlData items as "objects" and assign them OIDs within this context. If we take that approach, the enum could be named ControlDataOid: ``` /* Define the string enums */ #define CONTROLDATA_LINE(symbol, description, fmt, ...) \ symbol, enum { #include "entries.h=E2=80=9D } ControlDataOid; #undef CONTROLDATA_LINE ``` This makes reusing simple_oid_list feel appropriate. If you aren't fond = of that idea, I=E2=80=99d suggest naming the enum ControlDataSymbol = rather than ControlDataStrings, as the former better reflects what the = members actually are. Regarding patch 0002: ``` +#define CONTROLDATA_LINE(symbol, description, fmt, ...) = \ + if (simple_oid_list_member(&toprint, symbol)) = \ + { = \ + thislen =3D internal_wcswidth(_(description), = \ + = strlen(_(description)), \ + = encoding); \ + if (thislen > maxlen) = \ + maxlen =3D thislen; = \ } +#include "entries.h" +#undef CONTROLDATA_LINE ``` The code block inside the first if statement is missing an indentation = level. Otherwise, the patch looks good to me. I've tested it and confirmed that = calculating the padding at runtime generates better-looking output. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/