Subject: [PATCH 7/8] Test trivial condition before more complex one

From: Alvaro Herrera <[email-masked]>
Date: Thu, 12 Mar 2020 18:32:53 -0300

---
 src/backend/executor/nodeIncrementalSort.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/backend/executor/nodeIncrementalSort.c b/src/backend/executor/nodeIncrementalSort.c
index be1afbb169..909d2df53f 100644
--- a/src/backend/executor/nodeIncrementalSort.c
+++ b/src/backend/executor/nodeIncrementalSort.c
@@ -499,9 +499,9 @@ ExecIncrementalSort(PlanState *pstate)
 		read_sortstate = node->execution_status == INCSORT_READFULLSORT ?
 			fullsort_state : node->prefixsort_state;
 		slot = node->ss.ps.ps_ResultTupleSlot;
-		if (tuplesort_gettupleslot(read_sortstate, ScanDirectionIsForward(dir),
-								   false, slot, NULL) || node->finished)
-
+		if (node->finished ||
+			tuplesort_gettupleslot(read_sortstate, ScanDirectionIsForward(dir),
+								   false, slot, NULL))
 			/*
 			 * TODO: there isn't a good test case for the node->finished case
 			 * directly, but lots of other stuff fails if it's not there. If
-- 
2.20.1

--jI8keyz6grp/JLjh
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
 filename="0008-reverse-arguments-.-isn-t-the-other-order-a-bug.patch"