From: David Rowley Date: Thu, 24 Nov 2022 21:10:44 +0000 (+1300) Subject: Improve indenting in _hash_pgaddtup X-Git-Tag: REL_16_BETA1~1240 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ec5affdbc283252327e217f99c45574eb63de051;p=thirdparty%2Fpostgresql.git Improve indenting in _hash_pgaddtup The Assert added in d09dbeb9b came out rather ugly after having run pgindent on that code. Here we adjust things to use some local variables so that the Assert remains within the 80-character margin. Author: Ted Yu Discussion: https://postgr.es/m/CALte62wLSir1=x93Jf0xZvHaO009FEJfhVMFwnaR8q=csPP8kQ@mail.gmail.com --- diff --git a/src/backend/access/hash/hashinsert.c b/src/backend/access/hash/hashinsert.c index 9db522051ef..9a921e341e7 100644 --- a/src/backend/access/hash/hashinsert.c +++ b/src/backend/access/hash/hashinsert.c @@ -290,12 +290,20 @@ _hash_pgaddtup(Relation rel, Buffer buf, Size itemsize, IndexTuple itup, { itup_off = PageGetMaxOffsetNumber(page) + 1; +#ifdef USE_ASSERT_CHECKING /* ensure this tuple's hashkey is >= the final existing tuple */ - Assert(PageGetMaxOffsetNumber(page) == 0 || - _hash_get_indextuple_hashkey((IndexTuple) - PageGetItem(page, PageGetItemId(page, - PageGetMaxOffsetNumber(page)))) <= - _hash_get_indextuple_hashkey(itup)); + if (PageGetMaxOffsetNumber(page) > 0) + { + IndexTuple lasttup; + ItemId itemid; + + itemid = PageGetItemId(page, PageGetMaxOffsetNumber(page)); + lasttup = (IndexTuple) PageGetItem(page, itemid); + + Assert(_hash_get_indextuple_hashkey(lasttup) <= + _hash_get_indextuple_hashkey(itup)); + } +#endif } else {