Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ec5affd

Browse files
committed
Improve indenting in _hash_pgaddtup
The Assert added in d09dbeb 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
1 parent 2cf41cd commit ec5affd

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/backend/access/hash/hashinsert.c

+13-5
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,20 @@ _hash_pgaddtup(Relation rel, Buffer buf, Size itemsize, IndexTuple itup,
290290
{
291291
itup_off = PageGetMaxOffsetNumber(page) + 1;
292292

293+
#ifdef USE_ASSERT_CHECKING
293294
/* ensure this tuple's hashkey is >= the final existing tuple */
294-
Assert(PageGetMaxOffsetNumber(page) == 0 ||
295-
_hash_get_indextuple_hashkey((IndexTuple)
296-
PageGetItem(page, PageGetItemId(page,
297-
PageGetMaxOffsetNumber(page)))) <=
298-
_hash_get_indextuple_hashkey(itup));
295+
if (PageGetMaxOffsetNumber(page) > 0)
296+
{
297+
IndexTuple lasttup;
298+
ItemId itemid;
299+
300+
itemid = PageGetItemId(page, PageGetMaxOffsetNumber(page));
301+
lasttup = (IndexTuple) PageGetItem(page, itemid);
302+
303+
Assert(_hash_get_indextuple_hashkey(lasttup) <=
304+
_hash_get_indextuple_hashkey(itup));
305+
}
306+
#endif
299307
}
300308
else
301309
{

0 commit comments

Comments
 (0)