On Thu, Nov 24, 2022 at 7:11 AM Tom Lane <t...@sss.pgh.pa.us> wrote:

> Daniel Gustafsson <dan...@yesql.se> writes:
> >> On 24 Nov 2022, at 13:42, Ted Yu <yuzhih...@gmail.com> wrote:
> >> In _hash_pgaddtup(), it seems the indentation is off for the assertion.
>
> > Indentation is handled by applying src/tools/pgindent to the code, and
> > re-running it on this file yields no re-indentation so this is in fact
> correct
> > according to the pgindent rules.
>
> It is one messy bit of code though --- perhaps a little more thought
> about where to put line breaks would help?  Alternatively, it could
> be split into multiple statements, along the lines of
>
> #ifdef USE_ASSERT_CHECKING
>     if (PageGetMaxOffsetNumber(page) > 0)
>     {
>         IndexTuple lasttup = PageGetItem(page,
>                                          PageGetItemId(page,
>
>  PageGetMaxOffsetNumber(page)));
>
>         Assert(_hash_get_indextuple_hashkey(lasttup) <=
>                _hash_get_indextuple_hashkey(itup));
>     }
> #endif
>
> (details obviously tweakable)
>
>                         regards, tom lane
>

Thanks Tom for the suggestion.

Here is patch v2.

Attachment: hash-pgaddtup-indent-v2.patch
Description: Binary data

Reply via email to