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

« back to all changes in this revision

Viewing changes to src/backend/utils/cache/plancache.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:
12
12
 *
13
13
 * The plan cache manager itself is principally responsible for tracking
14
14
 * whether cached plans should be invalidated because of schema changes in
15
 
 * the objects they depend on.  When (and if) the next demand for a cached
 
15
 * the objects they depend on.  When (and if) the next demand for a cached
16
16
 * plan occurs, the query will be replanned.  Note that this could result
17
17
 * in an error, for example if a column referenced by the query is no
18
18
 * longer present.      The creator of a cached plan can specify whether it
21
21
 * caller to notice changes and cope with them.
22
22
 *
23
23
 * Currently, we track exactly the dependencies of plans on relations and
24
 
 * user-defined functions.  On relcache invalidation events or pg_proc
 
24
 * user-defined functions.      On relcache invalidation events or pg_proc
25
25
 * syscache invalidation events, we invalidate just those plans that depend
26
26
 * on the particular object being modified.  (Note: this scheme assumes
27
27
 * that any table modification that requires replanning will generate a
35
35
 * Portions Copyright (c) 1994, Regents of the University of California
36
36
 *
37
37
 * IDENTIFICATION
38
 
 *        $PostgreSQL: pgsql/src/backend/utils/cache/plancache.c,v 1.26 2009/01/01 17:23:50 momjian Exp $
 
38
 *        $PostgreSQL: pgsql/src/backend/utils/cache/plancache.c,v 1.27 2009/06/11 14:49:05 momjian Exp $
39
39
 *
40
40
 *-------------------------------------------------------------------------
41
41
 */
120
120
        MemoryContext source_context;
121
121
        MemoryContext oldcxt;
122
122
 
123
 
        Assert(query_string != NULL);                           /* required as of 8.4 */
 
123
        Assert(query_string != NULL);           /* required as of 8.4 */
124
124
 
125
125
        /*
126
126
         * Make a dedicated memory context for the CachedPlanSource and its
220
220
        OverrideSearchPath *search_path;
221
221
        MemoryContext oldcxt;
222
222
 
223
 
        Assert(query_string != NULL);                           /* required as of 8.4 */
 
223
        Assert(query_string != NULL);           /* required as of 8.4 */
224
224
 
225
225
        /*
226
226
         * Fetch current search_path into given context, but do any recalculation
475
475
 
476
476
                /*
477
477
                 * If a snapshot is already set (the normal case), we can just use
478
 
                 * that for parsing/planning.  But if it isn't, install one.  Note:
479
 
                 * no point in checking whether parse analysis requires a snapshot;
 
478
                 * that for parsing/planning.  But if it isn't, install one.  Note: no
 
479
                 * point in checking whether parse analysis requires a snapshot;
480
480
                 * utility commands don't have invalidatable plans, so we'd not get
481
481
                 * here for such a command.
482
482
                 */
609
609
                Assert(plan->refcount > 0);
610
610
 
611
611
                /*
612
 
                 * Although we don't want to acquire locks here, it still seems
613
 
                 * useful to check for expiration of a transient plan.
 
612
                 * Although we don't want to acquire locks here, it still seems useful
 
613
                 * to check for expiration of a transient plan.
614
614
                 */
615
615
                if (TransactionIdIsValid(plan->saved_xmin) &&
616
616
                        !TransactionIdEquals(plan->saved_xmin, TransactionXmin))
990
990
                                        {
991
991
                                                /* Invalidate the plan! */
992
992
                                                plan->dead = true;
993
 
                                                break;          /* out of invalItems scan */
 
993
                                                break;  /* out of invalItems scan */
994
994
                                        }
995
995
                                }
996
996
                                if (plan->dead)