Pass EXEC_FLAG_REWIND when initializing a tuplestore scan.

Since a rescan is possible, we must be able to rewind.

Thomas Munro, per a report from Prabhat Sabu

Discussion: http://postgr.es/m/CAEepm=2=Uv5fm=exqL+ygBxaO+-tgmC=o+63H4zYAXi9HtXf1w@mail.gmail.com
This commit is contained in:
Robert Haas 2017-05-09 23:13:21 -04:00
parent 3439f84475
commit 304007d9f1

View File

@ -107,7 +107,7 @@ ExecInitNamedTuplestoreScan(NamedTuplestoreScan *node, EState *estate, int eflag
scanstate->relation = (Tuplestorestate *) enr->reldata; scanstate->relation = (Tuplestorestate *) enr->reldata;
scanstate->tupdesc = ENRMetadataGetTupDesc(&(enr->md)); scanstate->tupdesc = ENRMetadataGetTupDesc(&(enr->md));
scanstate->readptr = scanstate->readptr =
tuplestore_alloc_read_pointer(scanstate->relation, 0); tuplestore_alloc_read_pointer(scanstate->relation, EXEC_FLAG_REWIND);
/* /*
* The new read pointer copies its position from read pointer 0, which * The new read pointer copies its position from read pointer 0, which