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 1vQZSx-00BbrC-2J for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Dec 2025 23:07:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vQZSw-00AOuY-2Q for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Dec 2025 23:07:27 +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 1vQZSw-00AOuQ-14 for pgsql-hackers@lists.postgresql.org; Tue, 02 Dec 2025 23:07:26 +0000 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vQZSu-002pKO-0L for pgsql-hackers@lists.postgresql.org; Tue, 02 Dec 2025 23:07:25 +0000 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-7ad1cd0db3bso4849248b3a.1 for ; Tue, 02 Dec 2025 15:07:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764716844; x=1765321644; 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=59wVQA7pkyVNVwOcNoz+zB5Gmuz+iR1COv430GtrWzU=; b=BppKHj5lRq8M/J3dycrj41sKqG7Lvw/SMSB9tvlWgv3uNm2zfclM5BC69QDV8TW8Ul B5fiqOYjjooWWy+zH3g1wHgA52ZiRpROoKUhdkarENMXXFxKeQIsFrJT7JywJMuxJH7r CM2xGlQpwu0sYLe11llO5xakzegoxZ+d1CkeHwEmlKpuqPv1P81nVOzdr8z0+aZZysHH CB23UrYfn+DqI8G59yNa+QBRTlSQODde1MkPRd1Se4Pu4I5CyIsPEcaPkNNesNYrU2oO +dBL6vXZneqWm/efvHlOQ8Mk6KVKNNKsQnGjqMfxNDHadSHntM+A8VDt3nuMzrJzqhzt SGiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764716844; x=1765321644; 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=59wVQA7pkyVNVwOcNoz+zB5Gmuz+iR1COv430GtrWzU=; b=B+gMRnDBbUX7HInU3C7RgzkNjCFl/xskbfcMOiKndyyZBXyv9B7MpJ1uh81sA42qXP vIRaxqm4wbubmpQHwPxuiAVqV/gcC6TN1ktxlhPyvX31knSiZKKEuJPlk55ITiXQi2MD BEbTUPj5cjp9lE+AOPYv5fx/XoAjSWmBvZNx7ifcSTlFYC1ufsF9ZGXCE3hg4FCAxrJG EbryVPxYbUyFwyY0idKiEX2pwMTSJkEyRpaJwzTE8Mo83VrwOAAxqDzyVgYehtTXAkzS tPlrs2TTYY5ryvC9ibr0x6SUMjonxZTT3hlOco91T93iD5SgShi8k4Z3Ldbgzwgeqej3 u8Xg== X-Forwarded-Encrypted: i=1; AJvYcCX3bVpo/37/GNNpFmkN1/yh6RvDIQ37jflemUfV6gYmY9u12ao8Z0QZnANy/aT5y1usvINxvPn4FAfOXLBq@lists.postgresql.org X-Gm-Message-State: AOJu0YxRmMWJJ6xH2aWydea36Xx9zm6GeWrvPUG93LZ+9D9txolSoRmB 9NrTYllVZVGg7XkfdS3bw7rIUpJLDhqIA7yTiHULcfTSMfehyUdRyjQC X-Gm-Gg: ASbGncuFZKpqumYgqQq1prYufGYWUcxdLOF9xmb/cR+Ui5GrKw3qocmM9XGQ9YpReSZ A1/oLxCwiXmmFIFxJ03TvQ/UUBYp10cVF3GuebBdKP0xZHgmIJ0kDzVgwpUUGh3NYCiIdvSOE3n 9BIS2R2gOAqSBvG/9Kj38UhsMFbQQEmjQuf8Tx39EMx+jBsycpJ6qfHF9oXAwn6aXuEMOi7PbXj RAH5yPFl2txOsY644k5SuLGE4+f14I/Nx3y7tqsG85F6Pv2phAMU0v3xBCdvf5TBOM5GUXruDxY LDzc0ZLS8EU1kZXYIOoN8XduWmB7cdJMbot6KdUCa/9t2al5x5877Ylf3UcCvVz2hJfO0Lh5iDP z3XEyfpiIvd0e/HSLzUl9QNGZmKOstW9+JaE07ZO33bRLUTXKTDu1bzzLJfy6PgWzdjFMYAyvMu +ZlBx9aJNoJvLrQEbVnn0= X-Google-Smtp-Source: AGHT+IG15JVsfQhQnGVrFbTHeu5OJ4Dmj2TWWgaznayzo+T+cEdt35LUwjL6jIUJKFSV70AssDjFHA== X-Received: by 2002:a05:6a20:3950:b0:35d:19d3:5719 with SMTP id adf61e73a8af0-363f5bb2009mr538759637.0.1764716843749; Tue, 02 Dec 2025 15:07:23 -0800 (PST) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7d150c618e7sm18128673b3a.3.2025.12.02.15.07.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Dec 2025 15:07:21 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: pgindent versus struct members and typedefs From: Chao Li In-Reply-To: <509793.1764715875@sss.pgh.pa.us> Date: Wed, 3 Dec 2025 07:06:45 +0800 Cc: Nathan Bossart , Rahila Syed , Robert Haas , PostgreSQL Hackers Content-Transfer-Encoding: quoted-printable Message-Id: <5E70CB69-1E2D-471B-8CF8-83205E5E14CE@gmail.com> References: <347EA055-D626-414C-B10D-7E70041B9B55@gmail.com> <509793.1764715875@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3826.700.81) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Dec 3, 2025, at 06:51, Tom Lane wrote: >=20 > Chao Li writes: >> On Dec 3, 2025, at 06:00, Nathan Bossart = wrote: >>> I tried to fix pgindent for a few, but the code is basically = impenetrable. >>> 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 = this, >>> so IMHO the best thing to do here is nothing. >=20 >> I think that=E2=80=99s fine. >=20 > Agreed, not worth the trouble to fool with. >=20 >> Actually I see the other problem with pgindent, where if a =E2=80=9Cels= e=E2=80=9D clause contains a multiple-line comment and a single = statement without 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. >=20 > 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. >=20 For =E2=80=9Cone line=E2=80=9D, do you mean only a single line of = statement or one line statement plus one line comment? To clarify the pgindnet problem, if we have a one-line comment plus = one-line statement, for example: ``` else /* one line comment */ printf(=E2=80=A6); ``` In this case, pgindent will not add an empty line after =E2=80=9Celse=E2=80= =9D. But I totally agree with you, when there is a multiple-line comment and = a single statement, it's a good habit to add braces. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/