~ubuntu-branches/ubuntu/natty/postgresql-8.4/natty-security

« back to all changes in this revision

Viewing changes to src/backend/optimizer/util/placeholder.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:
9
9
 *
10
10
 *
11
11
 * IDENTIFICATION
12
 
 *        $PostgreSQL: pgsql/src/backend/optimizer/util/placeholder.c,v 1.4 2009/04/19 19:46:33 tgl Exp $
 
12
 *        $PostgreSQL: pgsql/src/backend/optimizer/util/placeholder.c,v 1.5 2009/06/11 14:48:59 momjian Exp $
13
13
 *
14
14
 *-------------------------------------------------------------------------
15
15
 */
72
72
        phinfo->ph_var = copyObject(phv);
73
73
        phinfo->ph_eval_at = pull_varnos((Node *) phv);
74
74
        /* ph_eval_at may change later, see fix_placeholder_eval_levels */
75
 
        phinfo->ph_needed = NULL;               /* initially it's unused */
 
75
        phinfo->ph_needed = NULL;       /* initially it's unused */
76
76
        /* for the moment, estimate width using just the datatype info */
77
77
        phinfo->ph_width = get_typavgwidth(exprType((Node *) phv->phexpr),
78
78
                                                                           exprTypmod((Node *) phv->phexpr));
88
88
 *
89
89
 * The initial eval_at level set by find_placeholder_info was the set of
90
90
 * rels used in the placeholder's expression (or the whole subselect if
91
 
 * the expr is variable-free).  If the subselect contains any outer joins
 
91
 * the expr is variable-free).  If the subselect contains any outer joins
92
92
 * that can null any of those rels, we must delay evaluation to above those
93
93
 * joins.
94
94
 *
153
153
                /*
154
154
                 * Now that we know where to evaluate the placeholder, make sure that
155
155
                 * any vars or placeholders it uses will be available at that join
156
 
                 * level.  NOTE: this could cause more PlaceHolderInfos to be added
157
 
                 * to placeholder_list.  That is okay because we'll process them
158
 
                 * before falling out of the foreach loop.  Also, it could cause
159
 
                 * the ph_needed sets of existing list entries to expand, which
160
 
                 * is also okay because this loop doesn't examine those.
 
156
                 * level.  NOTE: this could cause more PlaceHolderInfos to be added to
 
157
                 * placeholder_list.  That is okay because we'll process them before
 
158
                 * falling out of the foreach loop.  Also, it could cause the
 
159
                 * ph_needed sets of existing list entries to expand, which is also
 
160
                 * okay because this loop doesn't examine those.
161
161
                 */
162
162
                if (bms_membership(eval_at) == BMS_MULTIPLE)
163
163
                {
173
173
         * Now, if any placeholder can be computed at a base rel and is needed
174
174
         * above it, add it to that rel's targetlist.  (This is essentially the
175
175
         * same logic as in add_placeholders_to_joinrel, but we can't do that part
176
 
         * until joinrels are formed.)  We have to do this as a separate step
 
176
         * until joinrels are formed.)  We have to do this as a separate step
177
177
         * because the ph_needed values aren't stable until the previous loop
178
178
         * finishes.
179
179
         */