mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
pgindent run for release 9.3
This is the first run of the Perl-based pgindent script. Also update pgindent instructions.
This commit is contained in:
@ -47,7 +47,6 @@ int
|
||||
cx(PlannerInfo *root, Gene *tour1, Gene *tour2, Gene *offspring,
|
||||
int num_gene, City *city_table)
|
||||
{
|
||||
|
||||
int i,
|
||||
start_pos,
|
||||
curr_pos;
|
||||
|
@ -46,7 +46,6 @@ void
|
||||
px(PlannerInfo *root, Gene *tour1, Gene *tour2, Gene *offspring, int num_gene,
|
||||
City *city_table)
|
||||
{
|
||||
|
||||
int num_positions;
|
||||
int i,
|
||||
pos,
|
||||
|
@ -721,7 +721,7 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
|
||||
*/
|
||||
if (childrel->cheapest_total_path->param_info == NULL)
|
||||
subpaths = accumulate_append_subpath(subpaths,
|
||||
childrel->cheapest_total_path);
|
||||
childrel->cheapest_total_path);
|
||||
else
|
||||
subpaths_valid = false;
|
||||
|
||||
|
@ -69,7 +69,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <float.h> /* for _isnan */
|
||||
#include <float.h> /* for _isnan */
|
||||
#endif
|
||||
#include <math.h>
|
||||
|
||||
@ -3745,7 +3745,7 @@ set_subquery_size_estimates(PlannerInfo *root, RelOptInfo *rel)
|
||||
* The subquery could be an expansion of a view that's had columns
|
||||
* added to it since the current query was parsed, so that there are
|
||||
* non-junk tlist columns in it that don't correspond to any column
|
||||
* visible at our query level. Ignore such columns.
|
||||
* visible at our query level. Ignore such columns.
|
||||
*/
|
||||
if (te->resno < rel->min_attr || te->resno > rel->max_attr)
|
||||
continue;
|
||||
|
@ -294,7 +294,7 @@ process_equivalence(PlannerInfo *root, RestrictInfo *restrictinfo,
|
||||
|
||||
/*
|
||||
* We add ec2's items to ec1, then set ec2's ec_merged link to point
|
||||
* to ec1 and remove ec2 from the eq_classes list. We cannot simply
|
||||
* to ec1 and remove ec2 from the eq_classes list. We cannot simply
|
||||
* delete ec2 because that could leave dangling pointers in existing
|
||||
* PathKeys. We leave it behind with a link so that the merged EC can
|
||||
* be found.
|
||||
@ -2083,9 +2083,9 @@ generate_implied_equalities_for_column(PlannerInfo *root,
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Scan members, looking for a match to the target column. Note
|
||||
* that child EC members are considered, but only when they belong to
|
||||
* the target relation. (Unlike regular members, the same expression
|
||||
* Scan members, looking for a match to the target column. Note that
|
||||
* child EC members are considered, but only when they belong to the
|
||||
* target relation. (Unlike regular members, the same expression
|
||||
* could be a child member of more than one EC. Therefore, it's
|
||||
* potentially order-dependent which EC a child relation's target
|
||||
* column gets matched to. This is annoying but it only happens in
|
||||
|
@ -250,7 +250,7 @@ create_index_paths(PlannerInfo *root, RelOptInfo *rel)
|
||||
* If there are any rels that have LATERAL references to this one, we
|
||||
* cannot use join quals referencing them as index quals for this one,
|
||||
* since such rels would have to be on the inside not the outside of a
|
||||
* nestloop join relative to this one. Create a Relids set listing all
|
||||
* nestloop join relative to this one. Create a Relids set listing all
|
||||
* such rels, for use in checks of potential join clauses.
|
||||
*/
|
||||
lateral_referencers = NULL;
|
||||
@ -482,7 +482,7 @@ consider_index_join_clauses(PlannerInfo *root, RelOptInfo *rel,
|
||||
*
|
||||
* For simplicity in selecting relevant clauses, we represent each set of
|
||||
* outer rels as a maximum set of clause_relids --- that is, the indexed
|
||||
* relation itself is also included in the relids set. considered_relids
|
||||
* relation itself is also included in the relids set. considered_relids
|
||||
* lists all relids sets we've already tried.
|
||||
*/
|
||||
for (indexcol = 0; indexcol < index->ncolumns; indexcol++)
|
||||
@ -557,7 +557,7 @@ consider_index_join_outer_rels(PlannerInfo *root, RelOptInfo *rel,
|
||||
*/
|
||||
foreach(lc2, *considered_relids)
|
||||
{
|
||||
Relids oldrelids = (Relids) lfirst(lc2);
|
||||
Relids oldrelids = (Relids) lfirst(lc2);
|
||||
|
||||
/*
|
||||
* If either is a subset of the other, no new set is possible.
|
||||
@ -571,7 +571,7 @@ consider_index_join_outer_rels(PlannerInfo *root, RelOptInfo *rel,
|
||||
/*
|
||||
* If this clause was derived from an equivalence class, the
|
||||
* clause list may contain other clauses derived from the same
|
||||
* eclass. We should not consider that combining this clause with
|
||||
* eclass. We should not consider that combining this clause with
|
||||
* one of those clauses generates a usefully different
|
||||
* parameterization; so skip if any clause derived from the same
|
||||
* eclass would already have been included when using oldrelids.
|
||||
@ -654,9 +654,9 @@ get_join_index_paths(PlannerInfo *root, RelOptInfo *rel,
|
||||
}
|
||||
|
||||
/*
|
||||
* Add applicable eclass join clauses. The clauses generated for each
|
||||
* Add applicable eclass join clauses. The clauses generated for each
|
||||
* column are redundant (cf generate_implied_equalities_for_column),
|
||||
* so we need at most one. This is the only exception to the general
|
||||
* so we need at most one. This is the only exception to the general
|
||||
* rule of using all available index clauses.
|
||||
*/
|
||||
foreach(lc, eclauseset->indexclauses[indexcol])
|
||||
@ -2630,8 +2630,8 @@ check_partial_indexes(PlannerInfo *root, RelOptInfo *rel)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Construct a list of clauses that we can assume true for the purpose
|
||||
* of proving the index(es) usable. Restriction clauses for the rel are
|
||||
* Construct a list of clauses that we can assume true for the purpose of
|
||||
* proving the index(es) usable. Restriction clauses for the rel are
|
||||
* always usable, and so are any join clauses that are "movable to" this
|
||||
* rel. Also, we can consider any EC-derivable join clauses (which must
|
||||
* be "movable to" this rel, by definition).
|
||||
@ -2653,8 +2653,8 @@ check_partial_indexes(PlannerInfo *root, RelOptInfo *rel)
|
||||
/*
|
||||
* Add on any equivalence-derivable join clauses. Computing the correct
|
||||
* relid sets for generate_join_implied_equalities is slightly tricky
|
||||
* because the rel could be a child rel rather than a true baserel, and
|
||||
* in that case we must remove its parent's relid from all_baserels.
|
||||
* because the rel could be a child rel rather than a true baserel, and in
|
||||
* that case we must remove its parent's relid from all_baserels.
|
||||
*/
|
||||
if (rel->reloptkind == RELOPT_OTHER_MEMBER_REL)
|
||||
{
|
||||
@ -2671,8 +2671,8 @@ check_partial_indexes(PlannerInfo *root, RelOptInfo *rel)
|
||||
clauselist =
|
||||
list_concat(clauselist,
|
||||
generate_join_implied_equalities(root,
|
||||
bms_union(rel->relids,
|
||||
otherrels),
|
||||
bms_union(rel->relids,
|
||||
otherrels),
|
||||
otherrels,
|
||||
rel));
|
||||
|
||||
|
@ -154,7 +154,7 @@ add_paths_to_joinrel(PlannerInfo *root,
|
||||
* However, when a LATERAL subquery is involved, we have to be a bit
|
||||
* laxer, because there will simply not be any paths for the joinrel that
|
||||
* aren't parameterized by whatever the subquery is parameterized by,
|
||||
* unless its parameterization is resolved within the joinrel. Hence, add
|
||||
* unless its parameterization is resolved within the joinrel. Hence, add
|
||||
* to param_source_rels anything that is laterally referenced in either
|
||||
* input and is not in the join already.
|
||||
*/
|
||||
@ -507,7 +507,7 @@ sort_inner_and_outer(PlannerInfo *root,
|
||||
* sort.
|
||||
*
|
||||
* This function intentionally does not consider parameterized input
|
||||
* paths, except when the cheapest-total is parameterized. If we did so,
|
||||
* paths, except when the cheapest-total is parameterized. If we did so,
|
||||
* we'd have a combinatorial explosion of mergejoin paths of dubious
|
||||
* value. This interacts with decisions elsewhere that also discriminate
|
||||
* against mergejoins with parameterized inputs; see comments in
|
||||
|
@ -355,7 +355,7 @@ remove_rel_from_query(PlannerInfo *root, int relid, Relids joinrelids)
|
||||
* Likewise remove references from LateralJoinInfo data structures.
|
||||
*
|
||||
* If we are deleting a LATERAL subquery, we can forget its
|
||||
* LateralJoinInfo altogether. Otherwise, make sure the target is not
|
||||
* LateralJoinInfo altogether. Otherwise, make sure the target is not
|
||||
* included in any lateral_lhs set. (It probably can't be, since that
|
||||
* should have precluded deciding to remove it; but let's cope anyway.)
|
||||
*/
|
||||
|
@ -315,12 +315,12 @@ extract_lateral_references(PlannerInfo *root, RelOptInfo *brel, Index rtindex)
|
||||
newvars = NIL;
|
||||
foreach(lc, vars)
|
||||
{
|
||||
Node *node = (Node *) lfirst(lc);
|
||||
Node *node = (Node *) lfirst(lc);
|
||||
|
||||
node = copyObject(node);
|
||||
if (IsA(node, Var))
|
||||
{
|
||||
Var *var = (Var *) node;
|
||||
Var *var = (Var *) node;
|
||||
|
||||
/* Adjustment is easy since it's just one node */
|
||||
var->varlevelsup = 0;
|
||||
@ -328,7 +328,7 @@ extract_lateral_references(PlannerInfo *root, RelOptInfo *brel, Index rtindex)
|
||||
else if (IsA(node, PlaceHolderVar))
|
||||
{
|
||||
PlaceHolderVar *phv = (PlaceHolderVar *) node;
|
||||
int levelsup = phv->phlevelsup;
|
||||
int levelsup = phv->phlevelsup;
|
||||
|
||||
/* Have to work harder to adjust the contained expression too */
|
||||
if (levelsup != 0)
|
||||
@ -389,7 +389,7 @@ create_lateral_join_info(PlannerInfo *root)
|
||||
{
|
||||
RelOptInfo *brel = root->simple_rel_array[rti];
|
||||
Relids lateral_relids;
|
||||
ListCell *lc;
|
||||
ListCell *lc;
|
||||
|
||||
/* there may be empty slots corresponding to non-baserel RTEs */
|
||||
if (brel == NULL)
|
||||
@ -406,11 +406,11 @@ create_lateral_join_info(PlannerInfo *root)
|
||||
/* consider each laterally-referenced Var or PHV */
|
||||
foreach(lc, brel->lateral_vars)
|
||||
{
|
||||
Node *node = (Node *) lfirst(lc);
|
||||
Node *node = (Node *) lfirst(lc);
|
||||
|
||||
if (IsA(node, Var))
|
||||
{
|
||||
Var *var = (Var *) node;
|
||||
Var *var = (Var *) node;
|
||||
|
||||
add_lateral_info(root, rti, bms_make_singleton(var->varno));
|
||||
lateral_relids = bms_add_member(lateral_relids,
|
||||
@ -439,7 +439,7 @@ create_lateral_join_info(PlannerInfo *root)
|
||||
* If it's an appendrel parent, copy its lateral_relids to each child
|
||||
* rel. We intentionally give each child rel the same minimum
|
||||
* parameterization, even though it's quite possible that some don't
|
||||
* reference all the lateral rels. This is because any append path
|
||||
* reference all the lateral rels. This is because any append path
|
||||
* for the parent will have to have the same parameterization for
|
||||
* every child anyway, and there's no value in forcing extra
|
||||
* reparameterize_path() calls.
|
||||
@ -466,7 +466,7 @@ create_lateral_join_info(PlannerInfo *root)
|
||||
* add_lateral_info
|
||||
* Add a LateralJoinInfo to root->lateral_info_list, if needed
|
||||
*
|
||||
* We suppress redundant list entries. The passed lhs set must be freshly
|
||||
* We suppress redundant list entries. The passed lhs set must be freshly
|
||||
* made; we free it if not used in a new list entry.
|
||||
*/
|
||||
static void
|
||||
@ -861,11 +861,11 @@ make_outerjoininfo(PlannerInfo *root,
|
||||
Assert(jointype != JOIN_RIGHT);
|
||||
|
||||
/*
|
||||
* Presently the executor cannot support FOR [KEY] UPDATE/SHARE marking of rels
|
||||
* appearing on the nullable side of an outer join. (It's somewhat unclear
|
||||
* what that would mean, anyway: what should we mark when a result row is
|
||||
* generated from no element of the nullable relation?) So, complain if
|
||||
* any nullable rel is FOR [KEY] UPDATE/SHARE.
|
||||
* Presently the executor cannot support FOR [KEY] UPDATE/SHARE marking of
|
||||
* rels appearing on the nullable side of an outer join. (It's somewhat
|
||||
* unclear what that would mean, anyway: what should we mark when a result
|
||||
* row is generated from no element of the nullable relation?) So,
|
||||
* complain if any nullable rel is FOR [KEY] UPDATE/SHARE.
|
||||
*
|
||||
* You might be wondering why this test isn't made far upstream in the
|
||||
* parser. It's because the parser hasn't got enough info --- consider
|
||||
@ -1721,7 +1721,7 @@ distribute_restrictinfo_to_rels(PlannerInfo *root,
|
||||
* that provides all its variables.
|
||||
*
|
||||
* "nullable_relids" is the set of relids used in the expressions that are
|
||||
* potentially nullable below the expressions. (This has to be supplied by
|
||||
* potentially nullable below the expressions. (This has to be supplied by
|
||||
* caller because this function is used after deconstruct_jointree, so we
|
||||
* don't have knowledge of where the clause items came from.)
|
||||
*
|
||||
|
@ -260,8 +260,8 @@ optimize_minmax_aggregates(PlannerInfo *root, List *tlist,
|
||||
* We have to replace Aggrefs with Params in equivalence classes too, else
|
||||
* ORDER BY or DISTINCT on an optimized aggregate will fail. We don't
|
||||
* need to process child eclass members though, since they aren't of
|
||||
* interest anymore --- and replace_aggs_with_params_mutator isn't able
|
||||
* to handle Aggrefs containing translated child Vars, anyway.
|
||||
* interest anymore --- and replace_aggs_with_params_mutator isn't able to
|
||||
* handle Aggrefs containing translated child Vars, anyway.
|
||||
*
|
||||
* Note: at some point it might become necessary to mutate other data
|
||||
* structures too, such as the query's sortClause or distinctClause. Right
|
||||
|
@ -52,9 +52,9 @@ planner_hook_type planner_hook = NULL;
|
||||
#define EXPRKIND_QUAL 0
|
||||
#define EXPRKIND_TARGET 1
|
||||
#define EXPRKIND_RTFUNC 2
|
||||
#define EXPRKIND_RTFUNC_LATERAL 3
|
||||
#define EXPRKIND_RTFUNC_LATERAL 3
|
||||
#define EXPRKIND_VALUES 4
|
||||
#define EXPRKIND_VALUES_LATERAL 5
|
||||
#define EXPRKIND_VALUES_LATERAL 5
|
||||
#define EXPRKIND_LIMIT 6
|
||||
#define EXPRKIND_APPINFO 7
|
||||
#define EXPRKIND_PHV 8
|
||||
@ -571,9 +571,9 @@ subquery_planner(PlannerGlobal *glob, Query *parse,
|
||||
returningLists = NIL;
|
||||
|
||||
/*
|
||||
* If there was a FOR [KEY] UPDATE/SHARE clause, the LockRows node will
|
||||
* have dealt with fetching non-locked marked rows, else we need
|
||||
* to have ModifyTable do that.
|
||||
* If there was a FOR [KEY] UPDATE/SHARE clause, the LockRows node
|
||||
* will have dealt with fetching non-locked marked rows, else we
|
||||
* need to have ModifyTable do that.
|
||||
*/
|
||||
if (parse->rowMarks)
|
||||
rowMarks = NIL;
|
||||
@ -964,8 +964,8 @@ inheritance_planner(PlannerInfo *root)
|
||||
root->simple_rel_array = save_rel_array;
|
||||
|
||||
/*
|
||||
* If there was a FOR [KEY] UPDATE/SHARE clause, the LockRows node will have
|
||||
* dealt with fetching non-locked marked rows, else we need to have
|
||||
* If there was a FOR [KEY] UPDATE/SHARE clause, the LockRows node will
|
||||
* have dealt with fetching non-locked marked rows, else we need to have
|
||||
* ModifyTable do that.
|
||||
*/
|
||||
if (parse->rowMarks)
|
||||
@ -1060,7 +1060,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
|
||||
*/
|
||||
current_pathkeys = make_pathkeys_for_sortclauses(root,
|
||||
set_sortclauses,
|
||||
result_plan->targetlist);
|
||||
result_plan->targetlist);
|
||||
|
||||
/*
|
||||
* We should not need to call preprocess_targetlist, since we must be
|
||||
@ -1075,8 +1075,8 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
|
||||
tlist);
|
||||
|
||||
/*
|
||||
* Can't handle FOR [KEY] UPDATE/SHARE here (parser should have checked
|
||||
* already, but let's make sure).
|
||||
* Can't handle FOR [KEY] UPDATE/SHARE here (parser should have
|
||||
* checked already, but let's make sure).
|
||||
*/
|
||||
if (parse->rowMarks)
|
||||
ereport(ERROR,
|
||||
@ -1485,7 +1485,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
|
||||
* it's not worth trying to avoid it. In particular, think not to
|
||||
* skip adding the Result if the initial window_tlist matches the
|
||||
* top-level plan node's output, because we might change the tlist
|
||||
* inside the following loop.) Note that on second and subsequent
|
||||
* inside the following loop.) Note that on second and subsequent
|
||||
* passes through the following loop, the top-level node will be a
|
||||
* WindowAgg which we know can project; so we only need to check
|
||||
* once.
|
||||
@ -1500,14 +1500,14 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
|
||||
|
||||
/*
|
||||
* The "base" targetlist for all steps of the windowing process is
|
||||
* a flat tlist of all Vars and Aggs needed in the result. (In
|
||||
* a flat tlist of all Vars and Aggs needed in the result. (In
|
||||
* some cases we wouldn't need to propagate all of these all the
|
||||
* way to the top, since they might only be needed as inputs to
|
||||
* WindowFuncs. It's probably not worth trying to optimize that
|
||||
* though.) We also add window partitioning and sorting
|
||||
* expressions to the base tlist, to ensure they're computed only
|
||||
* once at the bottom of the stack (that's critical for volatile
|
||||
* functions). As we climb up the stack, we'll add outputs for
|
||||
* functions). As we climb up the stack, we'll add outputs for
|
||||
* the WindowFuncs computed at each level.
|
||||
*/
|
||||
window_tlist = make_windowInputTargetList(root,
|
||||
@ -1516,7 +1516,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
|
||||
|
||||
/*
|
||||
* The copyObject steps here are needed to ensure that each plan
|
||||
* node has a separately modifiable tlist. (XXX wouldn't a
|
||||
* node has a separately modifiable tlist. (XXX wouldn't a
|
||||
* shallow list copy do for that?)
|
||||
*/
|
||||
result_plan->targetlist = (List *) copyObject(window_tlist);
|
||||
@ -1543,7 +1543,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
|
||||
* plan's tlist for any partitioning or ordering columns that
|
||||
* aren't plain Vars. (In theory, make_windowInputTargetList
|
||||
* should have provided all such columns, but let's not assume
|
||||
* that here.) Furthermore, this way we can use existing
|
||||
* that here.) Furthermore, this way we can use existing
|
||||
* infrastructure to identify which input columns are the
|
||||
* interesting ones.
|
||||
*/
|
||||
@ -1741,9 +1741,9 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is a FOR [KEY] UPDATE/SHARE clause, add the LockRows node. (Note: we
|
||||
* intentionally test parse->rowMarks not root->rowMarks here. If there
|
||||
* are only non-locking rowmarks, they should be handled by the
|
||||
* If there is a FOR [KEY] UPDATE/SHARE clause, add the LockRows node.
|
||||
* (Note: we intentionally test parse->rowMarks not root->rowMarks here.
|
||||
* If there are only non-locking rowmarks, they should be handled by the
|
||||
* ModifyTable node instead.)
|
||||
*/
|
||||
if (parse->rowMarks)
|
||||
@ -1927,9 +1927,9 @@ preprocess_rowmarks(PlannerInfo *root)
|
||||
if (parse->rowMarks)
|
||||
{
|
||||
/*
|
||||
* We've got trouble if FOR [KEY] UPDATE/SHARE appears inside grouping,
|
||||
* since grouping renders a reference to individual tuple CTIDs
|
||||
* invalid. This is also checked at parse time, but that's
|
||||
* We've got trouble if FOR [KEY] UPDATE/SHARE appears inside
|
||||
* grouping, since grouping renders a reference to individual tuple
|
||||
* CTIDs invalid. This is also checked at parse time, but that's
|
||||
* insufficient because of rule substitution, query pullup, etc.
|
||||
*/
|
||||
CheckSelectLocking(parse);
|
||||
@ -1937,7 +1937,8 @@ preprocess_rowmarks(PlannerInfo *root)
|
||||
else
|
||||
{
|
||||
/*
|
||||
* We only need rowmarks for UPDATE, DELETE, or FOR [KEY] UPDATE/SHARE.
|
||||
* We only need rowmarks for UPDATE, DELETE, or FOR [KEY]
|
||||
* UPDATE/SHARE.
|
||||
*/
|
||||
if (parse->commandType != CMD_UPDATE &&
|
||||
parse->commandType != CMD_DELETE)
|
||||
@ -2238,7 +2239,7 @@ preprocess_limit(PlannerInfo *root, double tuple_fraction,
|
||||
*
|
||||
* If we have constant-zero OFFSET and constant-null LIMIT, we can skip adding
|
||||
* a Limit node. This is worth checking for because "OFFSET 0" is a common
|
||||
* locution for an optimization fence. (Because other places in the planner
|
||||
* locution for an optimization fence. (Because other places in the planner
|
||||
* merely check whether parse->limitOffset isn't NULL, it will still work as
|
||||
* an optimization fence --- we're just suppressing unnecessary run-time
|
||||
* overhead.)
|
||||
@ -2273,7 +2274,7 @@ limit_needed(Query *parse)
|
||||
/* Treat NULL as no offset; the executor would too */
|
||||
if (!((Const *) node)->constisnull)
|
||||
{
|
||||
int64 offset = DatumGetInt64(((Const *) node)->constvalue);
|
||||
int64 offset = DatumGetInt64(((Const *) node)->constvalue);
|
||||
|
||||
/* Executor would treat less-than-zero same as zero */
|
||||
if (offset > 0)
|
||||
@ -3107,7 +3108,7 @@ select_active_windows(PlannerInfo *root, WindowFuncLists *wflists)
|
||||
*
|
||||
* When grouping_planner inserts one or more WindowAgg nodes into the plan,
|
||||
* this function computes the initial target list to be computed by the node
|
||||
* just below the first WindowAgg. This list must contain all values needed
|
||||
* just below the first WindowAgg. This list must contain all values needed
|
||||
* to evaluate the window functions, compute the final target list, and
|
||||
* perform any required final sort step. If multiple WindowAggs are needed,
|
||||
* each intermediate one adds its window function results onto this tlist;
|
||||
@ -3115,7 +3116,7 @@ select_active_windows(PlannerInfo *root, WindowFuncLists *wflists)
|
||||
*
|
||||
* This function is much like make_subplanTargetList, though not quite enough
|
||||
* like it to share code. As in that function, we flatten most expressions
|
||||
* into their component variables. But we do not want to flatten window
|
||||
* into their component variables. But we do not want to flatten window
|
||||
* PARTITION BY/ORDER BY clauses, since that might result in multiple
|
||||
* evaluations of them, which would be bad (possibly even resulting in
|
||||
* inconsistent answers, if they contain volatile functions). Also, we must
|
||||
@ -3472,7 +3473,7 @@ plan_cluster_use_sort(Oid tableOid, Oid indexOid)
|
||||
rte = makeNode(RangeTblEntry);
|
||||
rte->rtekind = RTE_RELATION;
|
||||
rte->relid = tableOid;
|
||||
rte->relkind = RELKIND_RELATION; /* Don't be too picky. */
|
||||
rte->relkind = RELKIND_RELATION; /* Don't be too picky. */
|
||||
rte->lateral = false;
|
||||
rte->inh = false;
|
||||
rte->inFromCl = true;
|
||||
|
@ -608,7 +608,7 @@ pull_up_subqueries(PlannerInfo *root, Node *jtnode)
|
||||
*
|
||||
* If this jointree node is within either side of an outer join, then
|
||||
* lowest_outer_join references the lowest such JoinExpr node; otherwise
|
||||
* it is NULL. We use this to constrain the effects of LATERAL subqueries.
|
||||
* it is NULL. We use this to constrain the effects of LATERAL subqueries.
|
||||
*
|
||||
* If this jointree node is within the nullable side of an outer join, then
|
||||
* lowest_nulling_outer_join references the lowest such JoinExpr node;
|
||||
@ -702,11 +702,11 @@ pull_up_subqueries_recurse(PlannerInfo *root, Node *jtnode,
|
||||
case JOIN_INNER:
|
||||
j->larg = pull_up_subqueries_recurse(root, j->larg,
|
||||
lowest_outer_join,
|
||||
lowest_nulling_outer_join,
|
||||
lowest_nulling_outer_join,
|
||||
NULL);
|
||||
j->rarg = pull_up_subqueries_recurse(root, j->rarg,
|
||||
lowest_outer_join,
|
||||
lowest_nulling_outer_join,
|
||||
lowest_nulling_outer_join,
|
||||
NULL);
|
||||
break;
|
||||
case JOIN_LEFT:
|
||||
@ -714,7 +714,7 @@ pull_up_subqueries_recurse(PlannerInfo *root, Node *jtnode,
|
||||
case JOIN_ANTI:
|
||||
j->larg = pull_up_subqueries_recurse(root, j->larg,
|
||||
j,
|
||||
lowest_nulling_outer_join,
|
||||
lowest_nulling_outer_join,
|
||||
NULL);
|
||||
j->rarg = pull_up_subqueries_recurse(root, j->rarg,
|
||||
j,
|
||||
@ -738,7 +738,7 @@ pull_up_subqueries_recurse(PlannerInfo *root, Node *jtnode,
|
||||
NULL);
|
||||
j->rarg = pull_up_subqueries_recurse(root, j->rarg,
|
||||
j,
|
||||
lowest_nulling_outer_join,
|
||||
lowest_nulling_outer_join,
|
||||
NULL);
|
||||
break;
|
||||
default:
|
||||
@ -1080,7 +1080,7 @@ pull_up_simple_union_all(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte)
|
||||
|
||||
/*
|
||||
* Make a modifiable copy of the subquery's rtable, so we can adjust
|
||||
* upper-level Vars in it. There are no such Vars in the setOperations
|
||||
* upper-level Vars in it. There are no such Vars in the setOperations
|
||||
* tree proper, so fixing the rtable should be sufficient.
|
||||
*/
|
||||
rtable = copyObject(subquery->rtable);
|
||||
@ -1288,9 +1288,9 @@ is_simple_subquery(Query *subquery, RangeTblEntry *rte,
|
||||
return false;
|
||||
|
||||
/*
|
||||
* Don't pull up if the RTE represents a security-barrier view; we couldn't
|
||||
* prevent information leakage once the RTE's Vars are scattered about in
|
||||
* the upper query.
|
||||
* Don't pull up if the RTE represents a security-barrier view; we
|
||||
* couldn't prevent information leakage once the RTE's Vars are scattered
|
||||
* about in the upper query.
|
||||
*/
|
||||
if (rte->security_barrier)
|
||||
return false;
|
||||
@ -1304,9 +1304,9 @@ is_simple_subquery(Query *subquery, RangeTblEntry *rte,
|
||||
*/
|
||||
if (rte->lateral && lowest_outer_join != NULL)
|
||||
{
|
||||
Relids lvarnos = pull_varnos_of_level((Node *) subquery, 1);
|
||||
Relids jvarnos = get_relids_in_jointree((Node *) lowest_outer_join,
|
||||
true);
|
||||
Relids lvarnos = pull_varnos_of_level((Node *) subquery, 1);
|
||||
Relids jvarnos = get_relids_in_jointree((Node *) lowest_outer_join,
|
||||
true);
|
||||
|
||||
if (!bms_is_subset(lvarnos, jvarnos))
|
||||
return false;
|
||||
@ -1478,7 +1478,7 @@ replace_vars_in_jointree(Node *jtnode,
|
||||
/*
|
||||
* If the RangeTblRef refers to a LATERAL subquery (that isn't the
|
||||
* same subquery we're pulling up), it might contain references to the
|
||||
* target subquery, which we must replace. We drive this from the
|
||||
* target subquery, which we must replace. We drive this from the
|
||||
* jointree scan, rather than a scan of the rtable, for a couple of
|
||||
* reasons: we can avoid processing no-longer-referenced RTEs, and we
|
||||
* can use the appropriate setting of need_phvs depending on whether
|
||||
|
@ -3971,7 +3971,7 @@ evaluate_function(Oid funcid, Oid result_type, int32 result_typmod,
|
||||
newexpr->funcresulttype = result_type;
|
||||
newexpr->funcretset = false;
|
||||
newexpr->funcvariadic = funcvariadic;
|
||||
newexpr->funcformat = COERCE_EXPLICIT_CALL; /* doesn't matter */
|
||||
newexpr->funcformat = COERCE_EXPLICIT_CALL; /* doesn't matter */
|
||||
newexpr->funccollid = result_collid; /* doesn't matter */
|
||||
newexpr->inputcollid = input_collid;
|
||||
newexpr->args = args;
|
||||
|
@ -207,12 +207,12 @@ compare_path_costs_fuzzily(Path *path1, Path *path2, double fuzz_factor,
|
||||
*
|
||||
* cheapest_total_path is normally the cheapest-total-cost unparameterized
|
||||
* path; but if there are no unparameterized paths, we assign it to be the
|
||||
* best (cheapest least-parameterized) parameterized path. However, only
|
||||
* best (cheapest least-parameterized) parameterized path. However, only
|
||||
* unparameterized paths are considered candidates for cheapest_startup_path,
|
||||
* so that will be NULL if there are no unparameterized paths.
|
||||
*
|
||||
* The cheapest_parameterized_paths list collects all parameterized paths
|
||||
* that have survived the add_path() tournament for this relation. (Since
|
||||
* that have survived the add_path() tournament for this relation. (Since
|
||||
* add_path ignores pathkeys and startup cost for a parameterized path,
|
||||
* these will be paths that have best total cost or best row count for their
|
||||
* parameterization.) cheapest_parameterized_paths always includes the
|
||||
@ -282,6 +282,7 @@ set_cheapest(RelOptInfo *parent_rel)
|
||||
/* old path is less-parameterized, keep it */
|
||||
break;
|
||||
case BMS_DIFFERENT:
|
||||
|
||||
/*
|
||||
* This means that neither path has the least possible
|
||||
* parameterization for the rel. We'll sit on the old
|
||||
@ -328,8 +329,8 @@ set_cheapest(RelOptInfo *parent_rel)
|
||||
parameterized_paths = lcons(cheapest_total_path, parameterized_paths);
|
||||
|
||||
/*
|
||||
* If there is no unparameterized path, use the best parameterized path
|
||||
* as cheapest_total_path (but not as cheapest_startup_path).
|
||||
* If there is no unparameterized path, use the best parameterized path as
|
||||
* cheapest_total_path (but not as cheapest_startup_path).
|
||||
*/
|
||||
if (cheapest_total_path == NULL)
|
||||
cheapest_total_path = best_param_path;
|
||||
@ -501,7 +502,7 @@ add_path(RelOptInfo *parent_rel, Path *new_path)
|
||||
accept_new = false; /* old dominates new */
|
||||
else if (compare_path_costs_fuzzily(new_path,
|
||||
old_path,
|
||||
1.0000000001,
|
||||
1.0000000001,
|
||||
parent_rel->consider_startup) == COSTS_BETTER1)
|
||||
remove_old = true; /* new dominates old */
|
||||
else
|
||||
@ -1022,7 +1023,7 @@ create_result_path(List *quals)
|
||||
|
||||
pathnode->path.pathtype = T_Result;
|
||||
pathnode->path.parent = NULL;
|
||||
pathnode->path.param_info = NULL; /* there are no other rels... */
|
||||
pathnode->path.param_info = NULL; /* there are no other rels... */
|
||||
pathnode->path.pathkeys = NIL;
|
||||
pathnode->quals = quals;
|
||||
|
||||
|
Reference in New Issue
Block a user