From 2ae935298145de85c5cbb91b92eb6d051cdeb333 Mon Sep 17 00:00:00 2001
From: reshke <reshke@qavm-273b4667.qemu>
Date: Sat, 4 Jul 2026 18:33:21 +0300
Subject: [PATCH v1 2/2] Move CFI check before break condition.

---
 src/backend/access/gin/ginget.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c
index f36cc67fab0..47980b98048 100644
--- a/src/backend/access/gin/ginget.c
+++ b/src/backend/access/gin/ginget.c
@@ -565,11 +565,11 @@ startScanKey(GinState *ginstate, GinScanOpaque so, GinScanKey key)
 			/* Pass all entries <= i as FALSE, and the rest as MAYBE */
 			key->entryRes[entryIndexes[i]] = GIN_FALSE;
 
-			if (key->triConsistentFn(key) == GIN_FALSE)
-				break;
-
 			/* Make this loop interruptible in case there are many keys */
 			CHECK_FOR_INTERRUPTS();
+
+			if (key->triConsistentFn(key) == GIN_FALSE)
+				break;
 		}
 		/* i is now the last required entry. */
 
-- 
2.43.0

