On Fri, 25 Nov 2022 at 04:29, Ted Yu <[email protected]> wrote:
> Here is patch v2.
After running pgindent on v2, I see it still pushes the lines out
quite far. If I add a new line after PageGetItemId(page, and put the
variable assignment away from the variable declaration then it looks a
bit better. It's still 1 char over the limit.
David
diff --git a/src/backend/access/hash/hashinsert.c
b/src/backend/access/hash/hashinsert.c
index 9db522051e..dfc7a90d68 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;
+
+ lasttup = PageGetItem(page,
+
PageGetItemId(page,
+
PageGetMaxOffsetNumber(page)));
+
+ Assert(_hash_get_indextuple_hashkey(lasttup) <=
+ _hash_get_indextuple_hashkey(itup));
+ }
+#endif
}
else
{