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

Aleksander Alekseev <aleksander@tigerdata.com>

From: Aleksander Alekseev <aleksander@tigerdata.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Chao Li <li.evan.chao@gmail.com>, Nathan Bossart <nathandbossart@gmail.com>, Arseniy Mukhin <arseniy.mukhin.dev@gmail.com>, Bruce Momjian <bruce@momjian.us>, Michael Paquier <michael@paquier.xyz>
Date: 2025-11-10T09:28:06Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. pgindent: improve formatting of multiline comments.

  2. Adjust style of some debugging macros.

  3. Fix a couple of comments.

  4. Add IGNORE NULLS/RESPECT NULLS option to Window functions.

  5. Split WaitEventSet functions to separate source file

Attachments

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