diff options
Diffstat (limited to 'src/backend/executor/nodeCtescan.c')
-rw-r--r-- | src/backend/executor/nodeCtescan.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/executor/nodeCtescan.c b/src/backend/executor/nodeCtescan.c index 56fc15dccc7..67589908ce1 100644 --- a/src/backend/executor/nodeCtescan.c +++ b/src/backend/executor/nodeCtescan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeCtescan.c,v 1.3 2009/01/01 17:23:41 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeCtescan.c,v 1.4 2009/03/27 18:30:21 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -71,10 +71,14 @@ CteScanNext(CteScanState *node) /* * If we can fetch another tuple from the tuplestore, return it. + * + * Note: we have to use copy=true in the tuplestore_gettupleslot call, + * because we are sharing the tuplestore with other nodes that might + * write into the tuplestore before we get called again. */ if (!eof_tuplestore) { - if (tuplestore_gettupleslot(tuplestorestate, forward, slot)) + if (tuplestore_gettupleslot(tuplestorestate, forward, true, slot)) return slot; if (forward) eof_tuplestore = true; |