Re: indentation in _hash_pgaddtup()

From: Ted Yu <yuzhihong(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, 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:29:05
Message-ID: CALte62zk62wtP6uz1tQRRVRohCxJe_wVWTabUjkCKkWd2ZTAzA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 24, 2022 at 7:11 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

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

Thanks Tom for the suggestion.

Here is patch v2.

Attachment Content-Type Size
hash-pgaddtup-indent-v2.patch application/octet-stream 969 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Takamichi Osumi (Fujitsu) 2022-11-24 15:31:48 RE: Time delayed LR (WAS Re: logical replication restrictions)
Previous Message Dilip Kumar 2022-11-24 15:22:16 Re: Patch: Global Unique Index