1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +03:00

Use the correct tuplestore read pointer in a NamedTuplestoreScan.

Tom Kazimiers reported that transition tables don't work correctly when
they are scanned by more than one executor node.  That's because commit
18ce3a4ab allocated separate read pointers for each executor node, as it
must, but failed to make them active at the appropriate times.  Repair.

Thomas Munro

Discussion: https://postgr.es/m/20180224034748.bixarv6632vbxgeb%40dewberry.localdomain
This commit is contained in:
Tom Lane
2018-02-27 15:56:51 -05:00
parent c40e20a83c
commit e98a4de7d2
3 changed files with 50 additions and 0 deletions

View File

@ -40,6 +40,7 @@ NamedTuplestoreScanNext(NamedTuplestoreScanState *node)
* Get the next tuple from tuplestore. Return NULL if no more tuples.
*/
slot = node->ss.ss_ScanTupleSlot;
tuplestore_select_read_pointer(node->relation, node->readptr);
(void) tuplestore_gettupleslot(node->relation, true, false, slot);
return slot;
}
@ -116,6 +117,7 @@ ExecInitNamedTuplestoreScan(NamedTuplestoreScan *node, EState *estate, int eflag
* The new read pointer copies its position from read pointer 0, which
* could be anywhere, so explicitly rewind it.
*/
tuplestore_select_read_pointer(scanstate->relation, scanstate->readptr);
tuplestore_rescan(scanstate->relation);
/*