Re: indentation in _hash_pgaddtup() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: indentation in _hash_pgaddtup()
Date
Msg-id 3854935.1669302661@sss.pgh.pa.us
Whole thread Raw
In response to Re: indentation in _hash_pgaddtup()  (Daniel Gustafsson <daniel@yesql.se>)
Responses Re: indentation in _hash_pgaddtup()
List pgsql-hackers
Daniel Gustafsson <daniel@yesql.se> writes:
>> On 24 Nov 2022, at 13:42, Ted Yu <yuzhihong@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



pgsql-hackers by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: Patch: Global Unique Index
Next
From: "Takamichi Osumi (Fujitsu)"
Date:
Subject: Re: Time delayed LR (WAS Re: logical replication restrictions)