~ubuntu-branches/ubuntu/trusty/postgresql-8.4/trusty

« back to all changes in this revision

Viewing changes to src/backend/executor/nodeCtescan.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-11 16:59:35 UTC
  • mfrom: (5.1.1 karmic)
  • Revision ID: james.westby@ubuntu.com-20090711165935-jfwin6gfrxf0gfsi
Tags: 8.4.0-2
* debian/libpq-dev.install: Ship catalog/genbki.h. (Closes: #536139)
* debian/rules: Drop --enable-cassert for final release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 *
9
9
 *
10
10
 * IDENTIFICATION
11
 
 *        $PostgreSQL: pgsql/src/backend/executor/nodeCtescan.c,v 1.4 2009/03/27 18:30:21 tgl Exp $
 
11
 *        $PostgreSQL: pgsql/src/backend/executor/nodeCtescan.c,v 1.5 2009/06/11 14:48:57 momjian Exp $
12
12
 *
13
13
 *-------------------------------------------------------------------------
14
14
 */
73
73
         * If we can fetch another tuple from the tuplestore, return it.
74
74
         *
75
75
         * Note: we have to use copy=true in the tuplestore_gettupleslot call,
76
 
         * because we are sharing the tuplestore with other nodes that might
77
 
         * write into the tuplestore before we get called again.
 
76
         * because we are sharing the tuplestore with other nodes that might write
 
77
         * into the tuplestore before we get called again.
78
78
         */
79
79
        if (!eof_tuplestore)
80
80
        {
111
111
                 * Append a copy of the returned tuple to tuplestore.  NOTE: because
112
112
                 * our read pointer is certainly in EOF state, its read position will
113
113
                 * move forward over the added tuple.  This is what we want.  Also,
114
 
                 * any other readers will *not* move past the new tuple, which is
115
 
                 * what they want.
 
114
                 * any other readers will *not* move past the new tuple, which is what
 
115
                 * they want.
116
116
                 */
117
117
                tuplestore_puttupleslot(tuplestorestate, cteslot);
118
118
 
119
119
                /*
120
 
                 * We MUST copy the CTE query's output tuple into our own slot.
121
 
                 * This is because other CteScan nodes might advance the CTE query
122
 
                 * before we are called again, and our output tuple must stay
123
 
                 * stable over that.
 
120
                 * We MUST copy the CTE query's output tuple into our own slot. This
 
121
                 * is because other CteScan nodes might advance the CTE query before
 
122
                 * we are called again, and our output tuple must stay stable over
 
123
                 * that.
124
124
                 */
125
125
                return ExecCopySlot(slot, cteslot);
126
126
        }
193
193
                                                                                                         node->ctePlanId - 1);
194
194
 
195
195
        /*
196
 
         * The Param slot associated with the CTE query is used to hold a
197
 
         * pointer to the CteState of the first CteScan node that initializes
198
 
         * for this CTE.  This node will be the one that holds the shared
199
 
         * state for all the CTEs.
 
196
         * The Param slot associated with the CTE query is used to hold a pointer
 
197
         * to the CteState of the first CteScan node that initializes for this
 
198
         * CTE.  This node will be the one that holds the shared state for all the
 
199
         * CTEs.
200
200
         */
201
201
        prmdata = &(estate->es_param_exec_vals[node->cteParam]);
202
202
        Assert(prmdata->execPlan == NULL);
315
315
        if (node->leader == node)
316
316
        {
317
317
                /*
318
 
                 * The leader is responsible for clearing the tuplestore if a new
319
 
                 * scan of the underlying CTE is required.
 
318
                 * The leader is responsible for clearing the tuplestore if a new scan
 
319
                 * of the underlying CTE is required.
320
320
                 */
321
321
                if (node->cteplanstate->chgParam != NULL)
322
322
                {