diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-05-15 21:19:55 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-05-15 21:19:55 +0000 |
commit | 2ef172a2a4d8c093c0f2d4d580d5aab1ca8dcffe (patch) | |
tree | 44d64e7d8c43ed64d37622f90a949c5bb918f0c3 /src/backend/executor/nodeSeqscan.c | |
parent | eb0d00a9becb865c51c4e4c43f522d5c20addfe3 (diff) |
Fix latent bug in ExecSeqRestrPos: it leaves the plan node's result slot
in an inconsistent state. (This is only latent because in reality
ExecSeqRestrPos is dead code at the moment ... but someday maybe it won't
be.) Add some comments about what the API for plan node mark/restore
actually is, because it's not immediately obvious.
Diffstat (limited to 'src/backend/executor/nodeSeqscan.c')
-rw-r--r-- | src/backend/executor/nodeSeqscan.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/backend/executor/nodeSeqscan.c b/src/backend/executor/nodeSeqscan.c index f5a284a26bf..fab526f399c 100644 --- a/src/backend/executor/nodeSeqscan.c +++ b/src/backend/executor/nodeSeqscan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeSeqscan.c,v 1.52 2005/03/16 21:38:07 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeSeqscan.c,v 1.53 2005/05/15 21:19:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -342,9 +342,8 @@ ExecSeqReScan(SeqScanState *node, ExprContext *exprCtxt) void ExecSeqMarkPos(SeqScanState *node) { - HeapScanDesc scan; + HeapScanDesc scan = node->ss_currentScanDesc; - scan = node->ss_currentScanDesc; heap_markpos(scan); } @@ -357,8 +356,15 @@ ExecSeqMarkPos(SeqScanState *node) void ExecSeqRestrPos(SeqScanState *node) { - HeapScanDesc scan; + HeapScanDesc scan = node->ss_currentScanDesc; + + /* + * Clear any reference to the previously returned tuple. This is + * needed because the slot is simply pointing at scan->rs_cbuf, which + * heap_restrpos will change; we'd have an internally inconsistent + * slot if we didn't do this. + */ + ExecClearTuple(node->ss_ScanTupleSlot); - scan = node->ss_currentScanDesc; heap_restrpos(scan); } |