]> granicus.if.org Git - postgresql/commitdiff
Fix rescan of IndexScan node with the new lossy GiST distance functions.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 25 May 2015 11:42:21 +0000 (14:42 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 25 May 2015 11:48:29 +0000 (14:48 +0300)
Must reset the "reached end" flag and reorder queue at rescan.

Per report from Regina Obe, bug #13349

src/backend/executor/nodeIndexscan.c

index 7fd90415f96d0ccd12cdd065066f3c0abf1893ca..c0f14dbfa9d566f4c47973f2f5d01cb52c699cab 100644 (file)
@@ -532,10 +532,18 @@ ExecReScanIndexScan(IndexScanState *node)
        }
        node->iss_RuntimeKeysReady = true;
 
+       /* flush the reorder queue */
+       if (node->iss_ReorderQueue)
+       {
+               while (!pairingheap_is_empty(node->iss_ReorderQueue))
+                       reorderqueue_pop(node);
+       }
+
        /* reset index scan */
        index_rescan(node->iss_ScanDesc,
                                 node->iss_ScanKeys, node->iss_NumScanKeys,
                                 node->iss_OrderByKeys, node->iss_NumOrderByKeys);
+       node->iss_ReachedEnd = false;
 
        ExecScanReScan(&node->ss);
 }