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 1vQZDM-00BVD7-1Y for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Dec 2025 22:51:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vQZDL-00ALd4-1J for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Dec 2025 22:51:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQZDL-00ALcu-0O for pgsql-hackers@lists.postgresql.org; Tue, 02 Dec 2025 22:51:19 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQZDI-002pED-1m for pgsql-hackers@lists.postgresql.org; Tue, 02 Dec 2025 22:51:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 5B2MpF2J509794; Tue, 2 Dec 2025 17:51:15 -0500 From: Tom Lane To: Chao Li cc: Nathan Bossart , Rahila Syed , Robert Haas , PostgreSQL Hackers Subject: Re: pgindent versus struct members and typedefs In-reply-to: <347EA055-D626-414C-B10D-7E70041B9B55@gmail.com> References: <347EA055-D626-414C-B10D-7E70041B9B55@gmail.com> Comments: In-reply-to Chao Li message dated "Wed, 03 Dec 2025 06:46:33 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <509792.1764715875.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 02 Dec 2025 17:51:15 -0500 Message-ID: <509793.1764715875@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Chao Li writes: > On Dec 3, 2025, at 06:00, Nathan Bossart wrot= e: >> I tried to fix pgindent for a few, but the code is basically impenetrab= le. >> I didn't find any fixes upstream [0], either. As noted above, we could >> also fix it by avoiding the naming conflicts. However, I can't imagine >> that's worth the churn, and I've already spent way too much time on thi= s, >> so IMHO the best thing to do here is nothing. > I think that=E2=80=99s fine. Agreed, not worth the trouble to fool with. > Actually I see the other problem with pgindent, where if a =E2=80=9Celse= =E2=80=9D clause contains a multiple-line comment and a single statement w= ithout braces, for example: > ... > I tried to fix but failed. For that problem, a solution is to add braces= to the =E2=80=9Celse=E2=80=9D clause. In this case, I think pgindent is indirectly enforcing good style. I do not like omitting braces around anything that's more than one line; readers have to pay close attention to whether the code is doing what it was intended to. regards, tom lane