Improve indenting in _hash_pgaddtup
authorDavid Rowley <drowley@postgresql.org>
Thu, 24 Nov 2022 21:10:44 +0000 (10:10 +1300)
committerDavid Rowley <drowley@postgresql.org>
Thu, 24 Nov 2022 21:10:44 +0000 (10:10 +1300)
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

src/backend/access/hash/hashinsert.c

index 9db522051ef9fd2c94ed9432b8f5fdd450fe1167..9a921e341e78cf688f51ac91cb5fcbe0ff9b8ecc 100644 (file)
@@ -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
    {