Re: [PATCH] pg_bsd_indent: improve formatting of multiline comments

From: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Arseniy Mukhin <arseniy(dot)mukhin(dot)dev(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: [PATCH] pg_bsd_indent: improve formatting of multiline comments
Date: 2025-11-10 09:28:06
Message-ID: CAJ7c6TPCJz-ExBFL8q2dCkXZpUdpm=+wvTF11gDENGk39n3DYA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

> I am afraid that would generate a lot of noises for future reviews.
>
> 2. A typo in the patch
>
> ```
> + # Check each line except for the fist and the last one
> ```

Thanks, fixed.

> 3. As you are updating pgindent, I want to report an issue, you may address in a separate patch or just in this patch, up to you.
>
> See this code:
> ```
> else
> /*
> * fetch all the rest of the page
> */
> copysize = QUEUE_PAGESIZE - curoffset;
> ```
>
> In the “else” clause, there is a multiple-line comment block, and a single line of code. Pgindent will add an empty line between “else” and the comment block, which is weird. If the comment is one-line, then no empty line will be inserted.

I didn't manage to find this code. The closest thing I see is in
src/backend/commands/async.c:

```
else
{
/* fetch all the rest of the page */
copysize = QUEUE_PAGESIZE - curoffset;
}
```

Last time it was touched 15 years ago and pgindent processes it as expected.

> 1. I just ran the patched pgindent against a random file, then I got a lot diffs like:
>
> ```
> /*
> - * Direct advancement: avoid waking non-caught up backends that
> - * aren't interested in our notifications.
> + * Direct advancement: avoid waking non-caught up backends that aren't
> + * interested in our notifications.
> */
> ```

I'm not sure if this is part of the PostgreSQL code base either. My
best guess is that something is wrong with whitespaces here (tabs vs
spaces). We have plenty of multiline comments like this and from what
I can tell they are processed correctly.

--
Best regards,
Aleksander Alekseev

Attachment Content-Type Size
v6-0001-pgindent-improve-formatting-of-multiline-comments.patch text/x-patch 2.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2025-11-10 09:31:01 Re: Improve pg_sync_replication_slots() to wait for primary to advance
Previous Message Nishant Sharma 2025-11-10 09:27:27 Re: [PATCH] Add pg_get_tablespace_ddl() function to reconstruct CREATE TABLESPACE statement