Reset the binary heap in MergeAppend rescans.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 8e2b71d2d0381f7acc820a2400580a1e3a6add8c
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2013-08-30T23:15:21Z
Releases: 9.4.0
Reset the binary heap in MergeAppend rescans.

Failing to do so can cause queries to return wrong data, error out or crash.
This requires adding a new binaryheap_reset() method to binaryheap.c,
but that probably should have been there anyway.

Per bug #8410 from Terje Elde.  Diagnosis and patch by Andres Freund.

Files