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

From Ted Yu
Subject Re: indentation in _hash_pgaddtup()
Date
Msg-id CALte62zk62wtP6uz1tQRRVRohCxJe_wVWTabUjkCKkWd2ZTAzA@mail.gmail.com
Whole thread Raw
In response to Re: indentation in _hash_pgaddtup()  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: indentation in _hash_pgaddtup()
List pgsql-hackers


On Thu, Nov 24, 2022 at 7:11 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
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

Thanks Tom for the suggestion. 

Here is patch v2.
Attachment

pgsql-hackers by date:

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