Re: indentation in _hash_pgaddtup()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Ted Yu <yuzhihong(at)gmail(dot)com>, drowley(at)postgresql(dot)org, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: indentation in _hash_pgaddtup()
Date: 2022-11-24 15:11:01
Message-ID: 3854935.1669302661@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
>> On 24 Nov 2022, at 13:42, Ted Yu <yuzhihong(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Takamichi Osumi (Fujitsu) 2022-11-24 15:15:25 Re: Time delayed LR (WAS Re: logical replication restrictions)
Previous Message Thomas Kellerer 2022-11-24 15:00:59 Re: Patch: Global Unique Index