Re: [PATCH] pg_bsd_indent: improve formatting of multiline comments - Mailing list pgsql-hackers

From Chao Li
Subject Re: [PATCH] pg_bsd_indent: improve formatting of multiline comments
Date
Msg-id 9AD706B0-B73A-4DCC-9A71-F924D8B74F4B@gmail.com
Whole thread Raw
In response to Re: [PATCH] pg_bsd_indent: improve formatting of multiline comments  (Aleksander Alekseev <aleksander@tigerdata.com>)
List pgsql-hackers

> On Oct 27, 2025, at 20:13, Aleksander Alekseev <aleksander@tigerdata.com> wrote:
>
> Hi Nathan,
>
>>> Personally I don't have a strong opinion on this. We can easily add an
>>> exception for "/* ---" and "/* ===" comments if somebody believes this
>>> is a problem. I choose not to add such an exception just yet only
>>> because I don't like unnecessary exceptions :)
>>
>> +1 for adding an exception for "/* -----" style comments.  I tested running
>> pgindent after applying the patch, and the first thing I noticed was all
>> these (IMHO) unnecessary changes.  I don't think it helps readability, and
>> even if it did, it's arguably not worth the churn.
>
> OK, here is the corrected patch v5.
>
> --
> Best regards,
> Aleksander Alekseev
> <v5-0001-pgindent-improve-formatting-of-multiline-comments.patch>

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 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
```

fist => first

3. As you are updating pgindent, I want to report an issue, you may address in a separate patch or just in this patch,
upto 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
linebetween “else” and the comment block, which is weird. If the comment is one-line, then no empty line will be
inserted.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/




pgsql-hackers by date:

Previous
From: "iosif"
Date:
Subject: when called from extract_restriction_or_clauses(), the 4th check in join_clause_is_movable_to() is unnecessary
Next
From: Chao Li
Date:
Subject: Re: Optimize LISTEN/NOTIFY