mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Run pgindent on 9.2 source tree in preparation for first 9.3
commit-fest.
This commit is contained in:
4
src/backend/utils/cache/catcache.c
vendored
4
src/backend/utils/cache/catcache.c
vendored
@ -1637,8 +1637,8 @@ CatalogCacheCreateEntry(CatCache *cache, HeapTuple ntp,
|
||||
|
||||
/*
|
||||
* If there are any out-of-line toasted fields in the tuple, expand them
|
||||
* in-line. This saves cycles during later use of the catcache entry,
|
||||
* and also protects us against the possibility of the toast tuples being
|
||||
* in-line. This saves cycles during later use of the catcache entry, and
|
||||
* also protects us against the possibility of the toast tuples being
|
||||
* freed before we attempt to fetch them, in case of something using a
|
||||
* slightly stale catcache entry.
|
||||
*/
|
||||
|
2
src/backend/utils/cache/inval.c
vendored
2
src/backend/utils/cache/inval.c
vendored
@ -820,7 +820,7 @@ ProcessCommittedInvalidationMessages(SharedInvalidationMessage *msgs,
|
||||
* since they'll not have seen our changed tuples anyway. We can forget
|
||||
* about CurrentCmdInvalidMsgs too, since those changes haven't touched
|
||||
* the caches yet.
|
||||
*
|
||||
*
|
||||
* In any case, reset the various lists to empty. We need not physically
|
||||
* free memory here, since TopTransactionContext is about to be emptied
|
||||
* anyway.
|
||||
|
8
src/backend/utils/cache/lsyscache.c
vendored
8
src/backend/utils/cache/lsyscache.c
vendored
@ -283,7 +283,7 @@ get_sort_function_for_ordering_op(Oid opno, Oid *sortfunc,
|
||||
opcintype,
|
||||
opcintype,
|
||||
BTORDER_PROC);
|
||||
if (!OidIsValid(*sortfunc)) /* should not happen */
|
||||
if (!OidIsValid(*sortfunc)) /* should not happen */
|
||||
elog(ERROR, "missing support function %d(%u,%u) in opfamily %u",
|
||||
BTORDER_PROC, opcintype, opcintype, opfamily);
|
||||
*issupport = false;
|
||||
@ -1549,7 +1549,7 @@ func_volatile(Oid funcid)
|
||||
|
||||
/*
|
||||
* get_func_leakproof
|
||||
* Given procedure id, return the function's leakproof field.
|
||||
* Given procedure id, return the function's leakproof field.
|
||||
*/
|
||||
bool
|
||||
get_func_leakproof(Oid funcid)
|
||||
@ -2914,8 +2914,8 @@ get_range_subtype(Oid rangeOid)
|
||||
tp = SearchSysCache1(RANGETYPE, ObjectIdGetDatum(rangeOid));
|
||||
if (HeapTupleIsValid(tp))
|
||||
{
|
||||
Form_pg_range rngtup = (Form_pg_range) GETSTRUCT(tp);
|
||||
Oid result;
|
||||
Form_pg_range rngtup = (Form_pg_range) GETSTRUCT(tp);
|
||||
Oid result;
|
||||
|
||||
result = rngtup->rngsubtype;
|
||||
ReleaseSysCache(tp);
|
||||
|
82
src/backend/utils/cache/plancache.c
vendored
82
src/backend/utils/cache/plancache.c
vendored
@ -11,7 +11,7 @@
|
||||
* The logic for choosing generic or custom plans is in choose_custom_plan,
|
||||
* which see for comments.
|
||||
*
|
||||
* Cache invalidation is driven off sinval events. Any CachedPlanSource
|
||||
* Cache invalidation is driven off sinval events. Any CachedPlanSource
|
||||
* that matches the event is marked invalid, as is its generic CachedPlan
|
||||
* if it has one. When (and if) the next demand for a cached plan occurs,
|
||||
* parse analysis and rewrite is repeated to build a new valid query tree,
|
||||
@ -77,9 +77,9 @@ static void ReleaseGenericPlan(CachedPlanSource *plansource);
|
||||
static List *RevalidateCachedQuery(CachedPlanSource *plansource);
|
||||
static bool CheckCachedPlan(CachedPlanSource *plansource);
|
||||
static CachedPlan *BuildCachedPlan(CachedPlanSource *plansource, List *qlist,
|
||||
ParamListInfo boundParams);
|
||||
ParamListInfo boundParams);
|
||||
static bool choose_custom_plan(CachedPlanSource *plansource,
|
||||
ParamListInfo boundParams);
|
||||
ParamListInfo boundParams);
|
||||
static double cached_plan_cost(CachedPlan *plan);
|
||||
static void AcquireExecutorLocks(List *stmt_list, bool acquire);
|
||||
static void AcquirePlannerLocks(List *stmt_list, bool acquire);
|
||||
@ -111,7 +111,7 @@ InitPlanCache(void)
|
||||
* CreateCachedPlan: initially create a plan cache entry.
|
||||
*
|
||||
* Creation of a cached plan is divided into two steps, CreateCachedPlan and
|
||||
* CompleteCachedPlan. CreateCachedPlan should be called after running the
|
||||
* CompleteCachedPlan. CreateCachedPlan should be called after running the
|
||||
* query through raw_parser, but before doing parse analysis and rewrite;
|
||||
* CompleteCachedPlan is called after that. The reason for this arrangement
|
||||
* is that it can save one round of copying of the raw parse tree, since
|
||||
@ -198,13 +198,13 @@ CreateCachedPlan(Node *raw_parse_tree,
|
||||
* CompleteCachedPlan: second step of creating a plan cache entry.
|
||||
*
|
||||
* Pass in the analyzed-and-rewritten form of the query, as well as the
|
||||
* required subsidiary data about parameters and such. All passed values will
|
||||
* required subsidiary data about parameters and such. All passed values will
|
||||
* be copied into the CachedPlanSource's memory, except as specified below.
|
||||
* After this is called, GetCachedPlan can be called to obtain a plan, and
|
||||
* optionally the CachedPlanSource can be saved using SaveCachedPlan.
|
||||
*
|
||||
* If querytree_context is not NULL, the querytree_list must be stored in that
|
||||
* context (but the other parameters need not be). The querytree_list is not
|
||||
* context (but the other parameters need not be). The querytree_list is not
|
||||
* copied, rather the given context is kept as the initial query_context of
|
||||
* the CachedPlanSource. (It should have been created as a child of the
|
||||
* caller's working memory context, but it will now be reparented to belong
|
||||
@ -277,8 +277,8 @@ CompleteCachedPlan(CachedPlanSource *plansource,
|
||||
|
||||
/*
|
||||
* Use the planner machinery to extract dependencies. Data is saved in
|
||||
* query_context. (We assume that not a lot of extra cruft is created
|
||||
* by this call.)
|
||||
* query_context. (We assume that not a lot of extra cruft is created by
|
||||
* this call.)
|
||||
*/
|
||||
extract_query_dependencies((Node *) querytree_list,
|
||||
&plansource->relationOids,
|
||||
@ -327,7 +327,7 @@ CompleteCachedPlan(CachedPlanSource *plansource,
|
||||
*
|
||||
* This is guaranteed not to throw error; callers typically depend on that
|
||||
* since this is called just before or just after adding a pointer to the
|
||||
* CachedPlanSource to some permanent data structure of their own. Up until
|
||||
* CachedPlanSource to some permanent data structure of their own. Up until
|
||||
* this is done, a CachedPlanSource is just transient data that will go away
|
||||
* automatically on transaction abort.
|
||||
*/
|
||||
@ -341,16 +341,16 @@ SaveCachedPlan(CachedPlanSource *plansource)
|
||||
|
||||
/*
|
||||
* In typical use, this function would be called before generating any
|
||||
* plans from the CachedPlanSource. If there is a generic plan, moving
|
||||
* it into CacheMemoryContext would be pretty risky since it's unclear
|
||||
* plans from the CachedPlanSource. If there is a generic plan, moving it
|
||||
* into CacheMemoryContext would be pretty risky since it's unclear
|
||||
* whether the caller has taken suitable care with making references
|
||||
* long-lived. Best thing to do seems to be to discard the plan.
|
||||
* long-lived. Best thing to do seems to be to discard the plan.
|
||||
*/
|
||||
ReleaseGenericPlan(plansource);
|
||||
|
||||
/*
|
||||
* Reparent the source memory context under CacheMemoryContext so that
|
||||
* it will live indefinitely. The query_context follows along since it's
|
||||
* Reparent the source memory context under CacheMemoryContext so that it
|
||||
* will live indefinitely. The query_context follows along since it's
|
||||
* already a child of the other one.
|
||||
*/
|
||||
MemoryContextSetParent(plansource->context, CacheMemoryContext);
|
||||
@ -474,8 +474,8 @@ RevalidateCachedQuery(CachedPlanSource *plansource)
|
||||
}
|
||||
|
||||
/*
|
||||
* Discard the no-longer-useful query tree. (Note: we don't want to
|
||||
* do this any earlier, else we'd not have been able to release locks
|
||||
* Discard the no-longer-useful query tree. (Note: we don't want to do
|
||||
* this any earlier, else we'd not have been able to release locks
|
||||
* correctly in the race condition case.)
|
||||
*/
|
||||
plansource->is_valid = false;
|
||||
@ -484,14 +484,14 @@ RevalidateCachedQuery(CachedPlanSource *plansource)
|
||||
plansource->invalItems = NIL;
|
||||
|
||||
/*
|
||||
* Free the query_context. We don't really expect MemoryContextDelete to
|
||||
* Free the query_context. We don't really expect MemoryContextDelete to
|
||||
* fail, but just in case, make sure the CachedPlanSource is left in a
|
||||
* reasonably sane state. (The generic plan won't get unlinked yet,
|
||||
* but that's acceptable.)
|
||||
* reasonably sane state. (The generic plan won't get unlinked yet, but
|
||||
* that's acceptable.)
|
||||
*/
|
||||
if (plansource->query_context)
|
||||
{
|
||||
MemoryContext qcxt = plansource->query_context;
|
||||
MemoryContext qcxt = plansource->query_context;
|
||||
|
||||
plansource->query_context = NULL;
|
||||
MemoryContextDelete(qcxt);
|
||||
@ -553,7 +553,7 @@ RevalidateCachedQuery(CachedPlanSource *plansource)
|
||||
PopOverrideSearchPath();
|
||||
|
||||
/*
|
||||
* Check or update the result tupdesc. XXX should we use a weaker
|
||||
* Check or update the result tupdesc. XXX should we use a weaker
|
||||
* condition than equalTupleDescs() here?
|
||||
*
|
||||
* We assume the parameter types didn't change from the first time, so no
|
||||
@ -596,8 +596,8 @@ RevalidateCachedQuery(CachedPlanSource *plansource)
|
||||
|
||||
/*
|
||||
* Use the planner machinery to extract dependencies. Data is saved in
|
||||
* query_context. (We assume that not a lot of extra cruft is created
|
||||
* by this call.)
|
||||
* query_context. (We assume that not a lot of extra cruft is created by
|
||||
* this call.)
|
||||
*/
|
||||
extract_query_dependencies((Node *) qlist,
|
||||
&plansource->relationOids,
|
||||
@ -612,12 +612,12 @@ RevalidateCachedQuery(CachedPlanSource *plansource)
|
||||
plansource->query_list = qlist;
|
||||
|
||||
/*
|
||||
* Note: we do not reset generic_cost or total_custom_cost, although
|
||||
* we could choose to do so. If the DDL or statistics change that
|
||||
* prompted the invalidation meant a significant change in the cost
|
||||
* estimates, it would be better to reset those variables and start
|
||||
* fresh; but often it doesn't, and we're better retaining our hard-won
|
||||
* knowledge about the relative costs.
|
||||
* Note: we do not reset generic_cost or total_custom_cost, although we
|
||||
* could choose to do so. If the DDL or statistics change that prompted
|
||||
* the invalidation meant a significant change in the cost estimates, it
|
||||
* would be better to reset those variables and start fresh; but often it
|
||||
* doesn't, and we're better retaining our hard-won knowledge about the
|
||||
* relative costs.
|
||||
*/
|
||||
|
||||
plansource->is_valid = true;
|
||||
@ -728,7 +728,7 @@ BuildCachedPlan(CachedPlanSource *plansource, List *qlist,
|
||||
* we ought to be holding sufficient locks to prevent any invalidation.
|
||||
* However, if we're building a custom plan after having built and
|
||||
* rejected a generic plan, it's possible to reach here with is_valid
|
||||
* false due to an invalidation while making the generic plan. In theory
|
||||
* false due to an invalidation while making the generic plan. In theory
|
||||
* the invalidation must be a false positive, perhaps a consequence of an
|
||||
* sinval reset event or the CLOBBER_CACHE_ALWAYS debug code. But for
|
||||
* safety, let's treat it as real and redo the RevalidateCachedQuery call.
|
||||
@ -770,10 +770,10 @@ BuildCachedPlan(CachedPlanSource *plansource, List *qlist,
|
||||
}
|
||||
|
||||
/*
|
||||
* The planner may try to call SPI-using functions, which causes a
|
||||
* problem if we're already inside one. Rather than expect all
|
||||
* SPI-using code to do SPI_push whenever a replan could happen,
|
||||
* it seems best to take care of the case here.
|
||||
* The planner may try to call SPI-using functions, which causes a problem
|
||||
* if we're already inside one. Rather than expect all SPI-using code to
|
||||
* do SPI_push whenever a replan could happen, it seems best to take care
|
||||
* of the case here.
|
||||
*/
|
||||
spi_pushed = SPI_push_conditional();
|
||||
|
||||
@ -865,8 +865,8 @@ choose_custom_plan(CachedPlanSource *plansource, ParamListInfo boundParams)
|
||||
/*
|
||||
* Prefer generic plan if it's less than 10% more expensive than average
|
||||
* custom plan. This threshold is a bit arbitrary; it'd be better if we
|
||||
* had some means of comparing planning time to the estimated runtime
|
||||
* cost differential.
|
||||
* had some means of comparing planning time to the estimated runtime cost
|
||||
* differential.
|
||||
*
|
||||
* Note that if generic_cost is -1 (indicating we've not yet determined
|
||||
* the generic plan cost), we'll always prefer generic at this point.
|
||||
@ -966,7 +966,7 @@ GetCachedPlan(CachedPlanSource *plansource, ParamListInfo boundParams,
|
||||
{
|
||||
/* otherwise, it should be a sibling of the plansource */
|
||||
MemoryContextSetParent(plan->context,
|
||||
MemoryContextGetParent(plansource->context));
|
||||
MemoryContextGetParent(plansource->context));
|
||||
}
|
||||
/* Update generic_cost whenever we make a new generic plan */
|
||||
plansource->generic_cost = cached_plan_cost(plan);
|
||||
@ -984,7 +984,7 @@ GetCachedPlan(CachedPlanSource *plansource, ParamListInfo boundParams,
|
||||
|
||||
/*
|
||||
* If we choose to plan again, we need to re-copy the query_list,
|
||||
* since the planner probably scribbled on it. We can force
|
||||
* since the planner probably scribbled on it. We can force
|
||||
* BuildCachedPlan to do that by passing NIL.
|
||||
*/
|
||||
qlist = NIL;
|
||||
@ -1089,7 +1089,7 @@ CachedPlanSetParentContext(CachedPlanSource *plansource,
|
||||
*
|
||||
* This is a convenience routine that does the equivalent of
|
||||
* CreateCachedPlan + CompleteCachedPlan, using the data stored in the
|
||||
* input CachedPlanSource. The result is therefore "unsaved" (regardless
|
||||
* input CachedPlanSource. The result is therefore "unsaved" (regardless
|
||||
* of the state of the source), and we don't copy any generic plan either.
|
||||
* The result will be currently valid, or not, the same as the source.
|
||||
*/
|
||||
@ -1233,7 +1233,7 @@ AcquireExecutorLocks(List *stmt_list, bool acquire)
|
||||
{
|
||||
/*
|
||||
* Ignore utility statements, except those (such as EXPLAIN) that
|
||||
* contain a parsed-but-not-planned query. Note: it's okay to use
|
||||
* contain a parsed-but-not-planned query. Note: it's okay to use
|
||||
* ScanQueryForLocks, even though the query hasn't been through
|
||||
* rule rewriting, because rewriting doesn't change the query
|
||||
* representation.
|
||||
@ -1429,7 +1429,7 @@ plan_list_is_transient(List *stmt_list)
|
||||
|
||||
/*
|
||||
* PlanCacheComputeResultDesc: given a list of analyzed-and-rewritten Queries,
|
||||
* determine the result tupledesc it will produce. Returns NULL if the
|
||||
* determine the result tupledesc it will produce. Returns NULL if the
|
||||
* execution will not return tuples.
|
||||
*
|
||||
* Note: the result is created or copied into current memory context.
|
||||
|
12
src/backend/utils/cache/relcache.c
vendored
12
src/backend/utils/cache/relcache.c
vendored
@ -2540,7 +2540,7 @@ RelationBuildLocalRelation(const char *relname,
|
||||
|
||||
/*
|
||||
* Insert relation physical and logical identifiers (OIDs) into the right
|
||||
* places. For a mapped relation, we set relfilenode to zero and rely on
|
||||
* places. For a mapped relation, we set relfilenode to zero and rely on
|
||||
* RelationInitPhysicalAddr to consult the map.
|
||||
*/
|
||||
rel->rd_rel->relisshared = shared_relation;
|
||||
@ -3365,9 +3365,9 @@ RelationGetIndexList(Relation relation)
|
||||
result = insert_ordered_oid(result, index->indexrelid);
|
||||
|
||||
/*
|
||||
* indclass cannot be referenced directly through the C struct, because
|
||||
* it comes after the variable-width indkey field. Must extract the
|
||||
* datum the hard way...
|
||||
* indclass cannot be referenced directly through the C struct,
|
||||
* because it comes after the variable-width indkey field. Must
|
||||
* extract the datum the hard way...
|
||||
*/
|
||||
indclassDatum = heap_getattr(htup,
|
||||
Anum_pg_index_indclass,
|
||||
@ -4514,8 +4514,8 @@ RelationCacheInitFilePreInvalidate(void)
|
||||
/*
|
||||
* The file might not be there if no backend has been started since
|
||||
* the last removal. But complain about failures other than ENOENT.
|
||||
* Fortunately, it's not too late to abort the transaction if we
|
||||
* can't get rid of the would-be-obsolete init file.
|
||||
* Fortunately, it's not too late to abort the transaction if we can't
|
||||
* get rid of the would-be-obsolete init file.
|
||||
*/
|
||||
if (errno != ENOENT)
|
||||
ereport(ERROR,
|
||||
|
8
src/backend/utils/cache/ts_cache.c
vendored
8
src/backend/utils/cache/ts_cache.c
vendored
@ -602,10 +602,10 @@ check_TSCurrentConfig(char **newval, void **extra, GucSource source)
|
||||
cfgId = get_ts_config_oid(stringToQualifiedNameList(*newval), true);
|
||||
|
||||
/*
|
||||
* When source == PGC_S_TEST, we are checking the argument of an
|
||||
* ALTER DATABASE SET or ALTER USER SET command. It could be that
|
||||
* the intended use of the setting is for some other database, so
|
||||
* we should not error out if the text search configuration is not
|
||||
* When source == PGC_S_TEST, we are checking the argument of an ALTER
|
||||
* DATABASE SET or ALTER USER SET command. It could be that the
|
||||
* intended use of the setting is for some other database, so we
|
||||
* should not error out if the text search configuration is not
|
||||
* present in the current database. We issue a NOTICE instead.
|
||||
*/
|
||||
if (!OidIsValid(cfgId))
|
||||
|
Reference in New Issue
Block a user