Re: pgindent versus struct members and typedefs

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Rahila Syed <rahilasyed90(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgindent versus struct members and typedefs
Date: 2026-05-05 21:47:07
Message-ID: afplW8DvRONDc1yl@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 02, 2025 at 05:51:15PM -0500, Tom Lane wrote:
> Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> writes:
>> On Dec 3, 2025, at 06:00, Nathan Bossart <nathandbossart(at)gmail(dot)com> 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.
>
>> I think that’s fine.
>
> Agreed, not worth the trouble to fool with.

For fun, I spent some time with an AI tool to develop the attached fix for
this problem. The explanation seems reasonable to me, although I am by no
means a pgindent expert. When I looked at this in December, I did find
this similar commit from upstream [0], but I failed to make the connection
with last_u_d. 0002 is the result of a pgindent run after applying 0001.
You'll notice that it fixes the exact set of cases I found with grep
upthread.

[0] https://github.com/pstef/freebsd_indent/commit/afa2239

--
nathan

Attachment Content-Type Size
v1-0001-pgindent-Fix-spacing-after-when-member-name-match.patch text/plain 2.0 KB
v1-0002-run-pgindent.patch text/plain 3.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Paul A Jungwirth 2026-05-05 21:48:10 Re: Inconsistent trigger behavior between two temporal leftovers
Previous Message Andrew Dunstan 2026-05-05 21:36:02 Re: [BUG] CRASH: ECPGprepared_statement() and ECPGdeallocate_all() when connection is NULL