summaryrefslogtreecommitdiff
path: root/src/backend/optimizer
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2001-10-25 05:50:21 +0000
committerBruce Momjian <bruce@momjian.us>2001-10-25 05:50:21 +0000
commitb81844b1738c584d92330a5ccd0fbd8b603d2886 (patch)
tree4fae0d4cd26048177fc5cd1a2dd91abc99ba0f99 /src/backend/optimizer
parent59da2105d8e6d95345b3b942a2e2aba8cead4838 (diff)
pgindent run on all C files. Java run to follow. initdb/regression
tests pass.
Diffstat (limited to 'src/backend/optimizer')
-rw-r--r--src/backend/optimizer/geqo/geqo_erx.c4
-rw-r--r--src/backend/optimizer/geqo/geqo_main.c5
-rw-r--r--src/backend/optimizer/path/_deadcode/predmig.c7
-rw-r--r--src/backend/optimizer/path/_deadcode/xfunc.c7
-rw-r--r--src/backend/optimizer/path/allpaths.c76
-rw-r--r--src/backend/optimizer/path/clausesel.c22
-rw-r--r--src/backend/optimizer/path/costsize.c113
-rw-r--r--src/backend/optimizer/path/indxpath.c94
-rw-r--r--src/backend/optimizer/path/joinpath.c21
-rw-r--r--src/backend/optimizer/path/joinrels.c5
-rw-r--r--src/backend/optimizer/path/orindxpath.c6
-rw-r--r--src/backend/optimizer/path/pathkeys.c16
-rw-r--r--src/backend/optimizer/plan/createplan.c53
-rw-r--r--src/backend/optimizer/plan/initsplan.c69
-rw-r--r--src/backend/optimizer/plan/planmain.c4
-rw-r--r--src/backend/optimizer/plan/planner.c55
-rw-r--r--src/backend/optimizer/prep/prepkeyset.c1
-rw-r--r--src/backend/optimizer/prep/prepqual.c8
-rw-r--r--src/backend/optimizer/prep/preptlist.c8
-rw-r--r--src/backend/optimizer/prep/prepunion.c19
-rw-r--r--src/backend/optimizer/util/clauses.c35
-rw-r--r--src/backend/optimizer/util/joininfo.c4
-rw-r--r--src/backend/optimizer/util/pathnode.c8
-rw-r--r--src/backend/optimizer/util/plancat.c26
-rw-r--r--src/backend/optimizer/util/relnode.c32
-rw-r--r--src/backend/optimizer/util/tlist.c3
-rw-r--r--src/backend/optimizer/util/var.c10
27 files changed, 324 insertions, 387 deletions
diff --git a/src/backend/optimizer/geqo/geqo_erx.c b/src/backend/optimizer/geqo/geqo_erx.c
index 576ff5daa0c..748f3f31dfd 100644
--- a/src/backend/optimizer/geqo/geqo_erx.c
+++ b/src/backend/optimizer/geqo/geqo_erx.c
@@ -3,7 +3,7 @@
* geqo_erx.c
* edge recombination crossover [ER]
*
-* $Id: geqo_erx.c,v 1.15 1999/07/16 04:59:08 momjian Exp $
+* $Id: geqo_erx.c,v 1.16 2001/10/25 05:49:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -110,7 +110,6 @@ gimme_edge_table(Gene *tour1, Gene *tour2, int num_gene, Edge *edge_table)
for (index1 = 0; index1 < num_gene; index1++)
{
-
/*
* presume the tour is circular, i.e. 1->2, 2->3, 3->1 this
* operaton maps n back to 1
@@ -201,7 +200,6 @@ gimme_tour(Edge *edge_table, Gene *new_gene, int num_gene)
for (i = 1; i < num_gene; i++)
{
-
/*
* as each point is entered into the tour, remove it from the edge
* table
diff --git a/src/backend/optimizer/geqo/geqo_main.c b/src/backend/optimizer/geqo/geqo_main.c
index 61543985c58..496207d2a83 100644
--- a/src/backend/optimizer/geqo/geqo_main.c
+++ b/src/backend/optimizer/geqo/geqo_main.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: geqo_main.c,v 1.28 2001/06/03 14:53:56 petere Exp $
+ * $Id: geqo_main.c,v 1.29 2001/10/25 05:49:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -82,16 +82,13 @@ geqo(Query *root, int number_of_rels, List *initial_rels)
Edge *edge_table; /* list of edges */
int edge_failures = 0;
float difference;
-
#endif
#if defined(CX) || defined(PX) || defined(OX1) || defined(OX2)
City *city_table; /* list of cities */
-
#endif
#if defined(CX)
int cycle_diffs = 0;
int mutations = 0;
-
#endif
/* set GA parameters */
diff --git a/src/backend/optimizer/path/_deadcode/predmig.c b/src/backend/optimizer/path/_deadcode/predmig.c
index 462f1dc24ed..604de4b2735 100644
--- a/src/backend/optimizer/path/_deadcode/predmig.c
+++ b/src/backend/optimizer/path/_deadcode/predmig.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/_deadcode/Attic/predmig.c,v 1.10 2001/03/22 06:16:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/_deadcode/Attic/predmig.c,v 1.11 2001/10/25 05:49:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -244,7 +244,6 @@ xfunc_llel_chains(Stream root, Stream bottom)
if (is_clause(tmpstream)
&& get_pathptr(pathstream) != get_pathptr(tmpstream))
{
-
/*
* * If restriction moved above a Join after sort, we pull it *
* up in the join plan. * If restriction moved down, we
@@ -470,7 +469,7 @@ xfunc_form_groups(Query *queryInfo, Stream root, Stream bottom)
get_groupup((Stream) get_downstream(temp))) &&
get_grouprank(parent) < get_grouprank(temp))
{
- progress = true;/* we formed a new group */
+ progress = true; /* we formed a new group */
set_groupup(temp, true);
set_groupcost(temp,
get_groupcost(temp) +
@@ -485,7 +484,7 @@ xfunc_form_groups(Query *queryInfo, Stream root, Stream bottom)
}
-/* ------------------- UTILITY FUNCTIONS ------------------------- */
+/* ------------------- UTILITY FUNCTIONS ------------------------- */
/*
** xfunc_free_stream
diff --git a/src/backend/optimizer/path/_deadcode/xfunc.c b/src/backend/optimizer/path/_deadcode/xfunc.c
index 82258d7baf6..07866a9e4d0 100644
--- a/src/backend/optimizer/path/_deadcode/xfunc.c
+++ b/src/backend/optimizer/path/_deadcode/xfunc.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/_deadcode/Attic/xfunc.c,v 1.16 2001/03/22 06:16:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/_deadcode/Attic/xfunc.c,v 1.17 2001/10/25 05:49:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -237,7 +237,6 @@ xfunc_shouldpull(Query *queryInfo,
}
else if (maxrank != -(MAXFLOAT))
{
-
/*
* * we've left an expensive restriction below a join. Since *
* we may pullup this restriction in predmig.c, we'd best *
@@ -656,7 +655,6 @@ xfunc_width(LispValue clause)
}
else if (IsA(clause, Iter))
{
-
/*
* * An Iter returns a setof things, so return the width of a
* single * thing. * Note: THIS MAY NOT WORK RIGHT WHEN AGGS GET
@@ -668,7 +666,6 @@ xfunc_width(LispValue clause)
}
else if (fast_is_clause(clause))
{
-
/*
* * get function associated with this Oper, and treat this as * a
* Func
@@ -689,7 +686,6 @@ xfunc_width(LispValue clause)
if (get_func_tlist(func) != LispNil)
{
-
/*
* this function has a projection on it. Get the length of
* the projected attribute
@@ -1150,7 +1146,6 @@ xfunc_fixvars(LispValue clause, /* clause being pulled up */
tle = tlistentry_member((Var) clause, get_targetlist(rel));
if (tle == LispNil)
{
-
/*
* * The attribute we need is not in the target list, * so we
* have to add it. *
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index ebc303d4654..15f29847d31 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.79 2001/10/18 16:11:41 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.80 2001/10/25 05:49:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,10 +38,10 @@ static void set_base_rel_pathlists(Query *root);
static void set_plain_rel_pathlist(Query *root, RelOptInfo *rel,
RangeTblEntry *rte);
static void set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
- Index rti, RangeTblEntry *rte,
- List *inheritlist);
+ Index rti, RangeTblEntry *rte,
+ List *inheritlist);
static void set_subquery_pathlist(Query *root, RelOptInfo *rel,
- Index rti, RangeTblEntry *rte);
+ Index rti, RangeTblEntry *rte);
static RelOptInfo *make_one_rel_by_joins(Query *root, int levels_needed,
List *initial_rels);
@@ -160,7 +160,7 @@ set_plain_rel_pathlist(Query *root, RelOptInfo *rel, RangeTblEntry *rte)
* Build access paths for a inheritance tree rooted at rel
*
* inheritlist is a list of RT indexes of all tables in the inheritance tree,
- * including a duplicate of the parent itself. Note we will not come here
+ * including a duplicate of the parent itself. Note we will not come here
* unless there's at least one child in addition to the parent.
*
* NOTE: the passed-in rel and RTE will henceforth represent the appended
@@ -192,9 +192,9 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
elog(ERROR, "SELECT FOR UPDATE is not supported for inherit queries");
/*
- * The executor will check the parent table's access permissions when it
- * examines the parent's inheritlist entry. There's no need to check
- * twice, so turn off access check bits in the original RTE.
+ * The executor will check the parent table's access permissions when
+ * it examines the parent's inheritlist entry. There's no need to
+ * check twice, so turn off access check bits in the original RTE.
*/
rte->checkForRead = false;
rte->checkForWrite = false;
@@ -230,8 +230,8 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
/*
* Copy the parent's targetlist and restriction quals to the
* child, with attribute-number adjustment as needed. We don't
- * bother to copy the join quals, since we can't do any joining
- * of the individual tables.
+ * bother to copy the join quals, since we can't do any joining of
+ * the individual tables.
*/
childrel->targetlist = (List *)
adjust_inherited_attrs((Node *) rel->targetlist,
@@ -282,32 +282,32 @@ set_subquery_pathlist(Query *root, RelOptInfo *rel,
/*
* If there are any restriction clauses that have been attached to the
- * subquery relation, consider pushing them down to become HAVING quals
- * of the subquery itself. (Not WHERE clauses, since they may refer to
- * subquery outputs that are aggregate results. But planner.c will
- * transfer them into the subquery's WHERE if they do not.) This
- * transformation is useful because it may allow us to generate a better
- * plan for the subquery than evaluating all the subquery output rows
- * and then filtering them.
+ * subquery relation, consider pushing them down to become HAVING
+ * quals of the subquery itself. (Not WHERE clauses, since they may
+ * refer to subquery outputs that are aggregate results. But
+ * planner.c will transfer them into the subquery's WHERE if they do
+ * not.) This transformation is useful because it may allow us to
+ * generate a better plan for the subquery than evaluating all the
+ * subquery output rows and then filtering them.
*
* There are several cases where we cannot push down clauses:
*
* 1. If the subquery contains set ops (UNION/INTERSECT/EXCEPT) we do not
- * push down any qual clauses, since the planner doesn't support quals at
- * the top level of a setop. (With suitable analysis we could try to push
- * the quals down into the component queries of the setop, but getting it
- * right seems nontrivial. Work on this later.)
+ * push down any qual clauses, since the planner doesn't support quals
+ * at the top level of a setop. (With suitable analysis we could try
+ * to push the quals down into the component queries of the setop, but
+ * getting it right seems nontrivial. Work on this later.)
*
* 2. If the subquery has a LIMIT clause or a DISTINCT ON clause, we must
* not push down any quals, since that could change the set of rows
* returned. (Actually, we could push down quals into a DISTINCT ON
- * subquery if they refer only to DISTINCT-ed output columns, but checking
- * that seems more work than it's worth. In any case, a plain DISTINCT is
- * safe to push down past.)
+ * subquery if they refer only to DISTINCT-ed output columns, but
+ * checking that seems more work than it's worth. In any case, a
+ * plain DISTINCT is safe to push down past.)
*
* 3. We do not push down clauses that contain subselects, mainly because
- * I'm not sure it will work correctly (the subplan hasn't yet transformed
- * sublinks to subselects).
+ * I'm not sure it will work correctly (the subplan hasn't yet
+ * transformed sublinks to subselects).
*
* Non-pushed-down clauses will get evaluated as qpquals of the
* SubqueryScan node.
@@ -337,22 +337,23 @@ set_subquery_pathlist(Query *root, RelOptInfo *rel,
else
{
/*
- * We need to replace Vars in the clause (which must refer to
- * outputs of the subquery) with copies of the subquery's
- * targetlist expressions. Note that at this point, any
- * uplevel Vars in the clause should have been replaced with
- * Params, so they need no work.
+ * We need to replace Vars in the clause (which must refer
+ * to outputs of the subquery) with copies of the
+ * subquery's targetlist expressions. Note that at this
+ * point, any uplevel Vars in the clause should have been
+ * replaced with Params, so they need no work.
*/
clause = ResolveNew(clause, rti, 0,
subquery->targetList,
CMD_SELECT, 0);
subquery->havingQual = make_and_qual(subquery->havingQual,
clause);
+
/*
* We need not change the subquery's hasAggs or
- * hasSublinks flags, since we can't be pushing
- * down any aggregates that weren't there before,
- * and we don't push down subselects at all.
+ * hasSublinks flags, since we can't be pushing down any
+ * aggregates that weren't there before, and we don't push
+ * down subselects at all.
*/
}
}
@@ -412,7 +413,6 @@ make_fromexpr_rel(Query *root, FromExpr *from)
if (levels_needed == 1)
{
-
/*
* Single jointree node, so we're done.
*/
@@ -420,7 +420,6 @@ make_fromexpr_rel(Query *root, FromExpr *from)
}
else
{
-
/*
* Consider the different orders in which we could join the rels,
* using either GEQO or regular optimizer.
@@ -552,7 +551,7 @@ print_restrictclauses(Query *root, List *clauses)
static void
print_path(Query *root, Path *path, int indent)
{
- const char *ptype;
+ const char *ptype;
bool join;
int i;
@@ -650,7 +649,7 @@ debug_print_rel(Query *root, RelOptInfo *rel)
foreach(l, rel->joininfo)
{
- JoinInfo *j = (JoinInfo *) lfirst(l);
+ JoinInfo *j = (JoinInfo *) lfirst(l);
printf("\tjoininfo (");
print_relids(j->unjoined_relids);
@@ -669,5 +668,4 @@ debug_print_rel(Query *root, RelOptInfo *rel)
printf("\n");
fflush(stdout);
}
-
#endif /* OPTIMIZER_DEBUG */
diff --git a/src/backend/optimizer/path/clausesel.c b/src/backend/optimizer/path/clausesel.c
index 36d8f229f1b..fc509c4d944 100644
--- a/src/backend/optimizer/path/clausesel.c
+++ b/src/backend/optimizer/path/clausesel.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.46 2001/06/25 21:11:43 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.47 2001/10/25 05:49:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -48,7 +48,7 @@ typedef struct RangeQueryClause
} RangeQueryClause;
static void addRangeClause(RangeQueryClause **rqlist, Node *clause,
- bool varonleft, bool isLTsel, Selectivity s2);
+ bool varonleft, bool isLTsel, Selectivity s2);
/****************************************************************************
@@ -212,7 +212,6 @@ clauselist_selectivity(Query *root,
{
if (s2 < -0.01)
{
-
/*
* No data available --- use a default estimate that
* is small, but not real small.
@@ -221,7 +220,6 @@ clauselist_selectivity(Query *root,
}
else
{
-
/*
* It's just roundoff error; use a small positive
* value
@@ -275,7 +273,6 @@ addRangeClause(RangeQueryClause **rqlist, Node *clause,
for (rqelem = *rqlist; rqelem; rqelem = rqelem->next)
{
-
/*
* We use full equal() here because the "var" might be a function
* of one or more attributes of the same relation...
@@ -386,7 +383,6 @@ clause_selectivity(Query *root,
if (rte->subquery)
{
-
/*
* XXX not smart about subquery references... any way to
* do better?
@@ -395,7 +391,6 @@ clause_selectivity(Query *root,
}
else
{
-
/*
* A Var at the top of a clause must be a bool Var. This
* is equivalent to the clause reln.attribute = 't', so we
@@ -405,7 +400,7 @@ clause_selectivity(Query *root,
BooleanEqualOperator,
makeList2(var,
MAKEBOOLCONST(true,
- false)),
+ false)),
varRelid);
}
}
@@ -436,7 +431,6 @@ clause_selectivity(Query *root,
}
else if (or_clause(clause))
{
-
/*
* Selectivities for an 'or' clause are computed as s1+s2 - s1*s2
* to account for the probable overlap of selected tuple sets. XXX
@@ -461,7 +455,6 @@ clause_selectivity(Query *root,
if (varRelid != 0)
{
-
/*
* If we are considering a nestloop join then all clauses are
* restriction clauses, since we are only interested in the
@@ -471,7 +464,6 @@ clause_selectivity(Query *root,
}
else
{
-
/*
* Otherwise, it's a join if there's more than one relation
* used.
@@ -482,19 +474,18 @@ clause_selectivity(Query *root,
if (is_join_clause)
{
/* Estimate selectivity for a join clause. */
- s1 = join_selectivity(root, opno,
+ s1 = join_selectivity(root, opno,
((Expr *) clause)->args);
}
else
{
/* Estimate selectivity for a restriction clause. */
- s1 = restriction_selectivity(root, opno,
- ((Expr *) clause)->args, varRelid);
+ s1 = restriction_selectivity(root, opno,
+ ((Expr *) clause)->args, varRelid);
}
}
else if (is_funcclause(clause))
{
-
/*
* This is not an operator, so we guess at the selectivity. THIS
* IS A HACK TO GET V4 OUT THE DOOR. FUNCS SHOULD BE ABLE TO HAVE
@@ -504,7 +495,6 @@ clause_selectivity(Query *root,
}
else if (is_subplan(clause))
{
-
/*
* Just for the moment! FIX ME! - vadim 02/04/98
*/
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index 73d72a03cb3..4cfddf9e6ce 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -42,7 +42,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.78 2001/08/21 16:36:02 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.79 2001/10/25 05:49:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -271,10 +271,10 @@ cost_index(Path *path, Query *root,
*
* When the index ordering is exactly correlated with the table ordering
* (just after a CLUSTER, for example), the number of pages fetched should
- * be just sT. What's more, these will be sequential fetches, not the
- * random fetches that occur in the uncorrelated case. So, depending on
+ * be just sT. What's more, these will be sequential fetches, not the
+ * random fetches that occur in the uncorrelated case. So, depending on
* the extent of correlation, we should estimate the actual I/O cost
- * somewhere between s * T * 1.0 and PF * random_cost. We currently
+ * somewhere between s * T * 1.0 and PF * random_cost. We currently
* interpolate linearly between these two endpoints based on the
* correlation squared (XXX is that appropriate?).
*
@@ -301,7 +301,7 @@ cost_index(Path *path, Query *root,
}
else
{
- double lim;
+ double lim;
lim = (2.0 * T * b) / (2.0 * T - b);
if (tuples_fetched <= lim)
@@ -317,18 +317,19 @@ cost_index(Path *path, Query *root,
}
/*
- * min_IO_cost corresponds to the perfectly correlated case (csquared=1),
- * max_IO_cost to the perfectly uncorrelated case (csquared=0). Note
- * that we just charge random_page_cost per page in the uncorrelated
- * case, rather than using cost_nonsequential_access, since we've already
- * accounted for caching effects by using the Mackert model.
+ * min_IO_cost corresponds to the perfectly correlated case
+ * (csquared=1), max_IO_cost to the perfectly uncorrelated case
+ * (csquared=0). Note that we just charge random_page_cost per page
+ * in the uncorrelated case, rather than using
+ * cost_nonsequential_access, since we've already accounted for
+ * caching effects by using the Mackert model.
*/
min_IO_cost = ceil(indexSelectivity * T);
max_IO_cost = pages_fetched * random_page_cost;
/*
- * Now interpolate based on estimated index order correlation
- * to get total disk I/O cost for main table accesses.
+ * Now interpolate based on estimated index order correlation to get
+ * total disk I/O cost for main table accesses.
*/
csquared = indexCorrelation * indexCorrelation;
@@ -337,14 +338,14 @@ cost_index(Path *path, Query *root,
/*
* Estimate CPU costs per tuple.
*
- * Normally the indexquals will be removed from the list of
- * restriction clauses that we have to evaluate as qpquals, so we
- * should subtract their costs from baserestrictcost. XXX For a lossy
- * index, not all the quals will be removed and so we really shouldn't
- * subtract their costs; but detecting that seems more expensive than
- * it's worth. Also, if we are doing a join then some of the indexquals
- * are join clauses and shouldn't be subtracted. Rather than work out
- * exactly how much to subtract, we don't subtract anything.
+ * Normally the indexquals will be removed from the list of restriction
+ * clauses that we have to evaluate as qpquals, so we should subtract
+ * their costs from baserestrictcost. XXX For a lossy index, not all
+ * the quals will be removed and so we really shouldn't subtract their
+ * costs; but detecting that seems more expensive than it's worth.
+ * Also, if we are doing a join then some of the indexquals are join
+ * clauses and shouldn't be subtracted. Rather than work out exactly
+ * how much to subtract, we don't subtract anything.
*/
cpu_per_tuple = cpu_tuple_cost + baserel->baserestrictcost;
@@ -501,11 +502,11 @@ cost_nestloop(Path *path, Query *root,
/*
* NOTE: clearly, we must pay both outer and inner paths' startup_cost
- * before we can start returning tuples, so the join's startup cost
- * is their sum. What's not so clear is whether the inner path's
+ * before we can start returning tuples, so the join's startup cost is
+ * their sum. What's not so clear is whether the inner path's
* startup_cost must be paid again on each rescan of the inner path.
- * This is not true if the inner path is materialized, but probably
- * is true otherwise. Since we don't yet have clean handling of the
+ * This is not true if the inner path is materialized, but probably is
+ * true otherwise. Since we don't yet have clean handling of the
* decision whether to materialize a path, we can't tell here which
* will happen. As a compromise, charge 50% of the inner startup cost
* for each restart.
@@ -615,9 +616,9 @@ cost_mergejoin(Path *path, Query *root,
/*
* The number of tuple comparisons needed depends drastically on the
* number of equal keys in the two source relations, which we have no
- * good way of estimating. Somewhat arbitrarily, we charge one
- * tuple comparison (one cpu_operator_cost) for each tuple in the
- * two source relations. This is probably a lower bound.
+ * good way of estimating. Somewhat arbitrarily, we charge one tuple
+ * comparison (one cpu_operator_cost) for each tuple in the two source
+ * relations. This is probably a lower bound.
*/
run_cost += cpu_operator_cost *
(outer_path->parent->rows + inner_path->parent->rows);
@@ -625,7 +626,7 @@ cost_mergejoin(Path *path, Query *root,
/*
* For each tuple that gets through the mergejoin proper, we charge
* cpu_tuple_cost plus the cost of evaluating additional restriction
- * clauses that are to be applied at the join. It's OK to use an
+ * clauses that are to be applied at the join. It's OK to use an
* approximate selectivity here, since in most cases this is a minor
* component of the cost.
*/
@@ -685,8 +686,8 @@ cost_hashjoin(Path *path, Query *root,
run_cost += cpu_operator_cost * outer_path->parent->rows;
/*
- * Determine bucketsize fraction for inner relation. First we have
- * to figure out which side of the hashjoin clause is the inner side.
+ * Determine bucketsize fraction for inner relation. First we have to
+ * figure out which side of the hashjoin clause is the inner side.
*/
Assert(length(hashclauses) == 1);
Assert(IsA(lfirst(hashclauses), RestrictInfo));
@@ -696,9 +697,9 @@ cost_hashjoin(Path *path, Query *root,
right = get_rightop(restrictinfo->clause);
/*
- * Since we tend to visit the same clauses over and over when
- * planning a large query, we cache the bucketsize estimate in
- * the RestrictInfo node to avoid repeated lookups of statistics.
+ * Since we tend to visit the same clauses over and over when planning
+ * a large query, we cache the bucketsize estimate in the RestrictInfo
+ * node to avoid repeated lookups of statistics.
*/
if (intMember(right->varno, inner_path->parent->relids))
{
@@ -726,9 +727,9 @@ cost_hashjoin(Path *path, Query *root,
/*
* The number of tuple comparisons needed is the number of outer
- * tuples times the typical number of tuples in a hash bucket,
- * which is the inner relation size times its bucketsize fraction.
- * We charge one cpu_operator_cost per tuple comparison.
+ * tuples times the typical number of tuples in a hash bucket, which
+ * is the inner relation size times its bucketsize fraction. We charge
+ * one cpu_operator_cost per tuple comparison.
*/
run_cost += cpu_operator_cost * outer_path->parent->rows *
ceil(inner_path->parent->rows * innerbucketsize);
@@ -736,7 +737,7 @@ cost_hashjoin(Path *path, Query *root,
/*
* For each tuple that gets through the hashjoin proper, we charge
* cpu_tuple_cost plus the cost of evaluating additional restriction
- * clauses that are to be applied at the join. It's OK to use an
+ * clauses that are to be applied at the join. It's OK to use an
* approximate selectivity here, since in most cases this is a minor
* component of the cost.
*/
@@ -792,11 +793,11 @@ cost_hashjoin(Path *path, Query *root,
* distribution, so this will have to do for now.
*
* We can get the number of buckets the executor will use for the given
- * input relation. If the data were perfectly distributed, with the same
+ * input relation. If the data were perfectly distributed, with the same
* number of tuples going into each available bucket, then the bucketsize
* fraction would be 1/nbuckets. But this happy state of affairs will occur
* only if (a) there are at least nbuckets distinct data values, and (b)
- * we have a not-too-skewed data distribution. Otherwise the buckets will
+ * we have a not-too-skewed data distribution. Otherwise the buckets will
* be nonuniformly occupied. If the other relation in the join has a key
* distribution similar to this one's, then the most-loaded buckets are
* exactly those that will be probed most often. Therefore, the "average"
@@ -828,8 +829,8 @@ estimate_hash_bucketsize(Query *root, Var *var)
int nnumbers;
/*
- * Lookup info about var's relation and attribute;
- * if none available, return default estimate.
+ * Lookup info about var's relation and attribute; if none available,
+ * return default estimate.
*/
if (!IsA(var, Var))
return 0.1;
@@ -891,12 +892,13 @@ estimate_hash_bucketsize(Query *root, Var *var)
avgfreq = (1.0 - stats->stanullfrac) / ndistinct;
/*
- * Adjust ndistinct to account for restriction clauses. Observe we are
- * assuming that the data distribution is affected uniformly by the
- * restriction clauses!
+ * Adjust ndistinct to account for restriction clauses. Observe we
+ * are assuming that the data distribution is affected uniformly by
+ * the restriction clauses!
*
* XXX Possibly better way, but much more expensive: multiply by
- * selectivity of rel's restriction clauses that mention the target Var.
+ * selectivity of rel's restriction clauses that mention the target
+ * Var.
*/
ndistinct *= rel->rows / rel->tuples;
@@ -929,7 +931,8 @@ estimate_hash_bucketsize(Query *root, Var *var)
}
/*
- * Adjust estimated bucketsize upward to account for skewed distribution.
+ * Adjust estimated bucketsize upward to account for skewed
+ * distribution.
*/
if (avgfreq > 0.0 && mcvfreq > avgfreq)
estfract *= mcvfreq / avgfreq;
@@ -1084,19 +1087,20 @@ cost_qual_eval_walker(Node *node, Cost *total)
static Selectivity
approx_selectivity(Query *root, List *quals)
{
- Selectivity total = 1.0;
+ Selectivity total = 1.0;
List *l;
foreach(l, quals)
{
Node *qual = (Node *) lfirst(l);
- Selectivity selec;
+ Selectivity selec;
/*
* RestrictInfo nodes contain a this_selec field reserved for this
* routine's use, so that it's not necessary to evaluate the qual
- * clause's selectivity more than once. If the clause's selectivity
- * hasn't been computed yet, the field will contain -1.
+ * clause's selectivity more than once. If the clause's
+ * selectivity hasn't been computed yet, the field will contain
+ * -1.
*/
if (qual && IsA(qual, RestrictInfo))
{
@@ -1254,7 +1258,7 @@ set_joinrel_size_estimates(Query *root, RelOptInfo *rel,
* NB: this works best on base relations because it prefers to look at
* real Vars. It will fail to make use of pg_statistic info when applied
* to a subquery relation, even if the subquery outputs are simple vars
- * that we could have gotten info for. Is it worth trying to be smarter
+ * that we could have gotten info for. Is it worth trying to be smarter
* about subqueries?
*/
static void
@@ -1266,15 +1270,15 @@ set_rel_width(Query *root, RelOptInfo *rel)
foreach(tllist, rel->targetlist)
{
TargetEntry *tle = (TargetEntry *) lfirst(tllist);
- int32 item_width;
+ int32 item_width;
/*
* If it's a Var, try to get statistical info from pg_statistic.
*/
if (tle->expr && IsA(tle->expr, Var))
{
- Var *var = (Var *) tle->expr;
- Oid relid;
+ Var *var = (Var *) tle->expr;
+ Oid relid;
relid = getrelid(var->varno, root->rtable);
if (relid != InvalidOid)
@@ -1287,6 +1291,7 @@ set_rel_width(Query *root, RelOptInfo *rel)
}
}
}
+
/*
* Not a Var, or can't find statistics for it. Estimate using
* just the type info.
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index f30097ec282..71e6c3faf56 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.111 2001/08/21 16:36:02 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.112 2001/10/25 05:49:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -288,7 +288,6 @@ match_index_orclauses(RelOptInfo *rel,
if (restriction_is_or_clause(restrictinfo))
{
-
/*
* Add this index to the subclause index list for each
* subclause that it matches.
@@ -444,9 +443,10 @@ extract_or_indexqual_conditions(RelOptInfo *rel,
Oid *classes = index->classlist;
/*
- * Extract relevant indexclauses in indexkey order. This is essentially
- * just like group_clauses_by_indexkey() except that the input and
- * output are lists of bare clauses, not of RestrictInfo nodes.
+ * Extract relevant indexclauses in indexkey order. This is
+ * essentially just like group_clauses_by_indexkey() except that the
+ * input and output are lists of bare clauses, not of RestrictInfo
+ * nodes.
*/
do
{
@@ -459,7 +459,7 @@ extract_or_indexqual_conditions(RelOptInfo *rel,
{
foreach(item, orsubclause->args)
{
- Expr *subsubclause = (Expr *) lfirst(item);
+ Expr *subsubclause = (Expr *) lfirst(item);
if (match_clause_to_indexkey(rel, index,
curIndxKey, curClass,
@@ -470,9 +470,7 @@ extract_or_indexqual_conditions(RelOptInfo *rel,
else if (match_clause_to_indexkey(rel, index,
curIndxKey, curClass,
orsubclause, false))
- {
clausegroup = makeList1(orsubclause);
- }
/*
* If we found no clauses for this indexkey in the OR subclause
@@ -492,8 +490,8 @@ extract_or_indexqual_conditions(RelOptInfo *rel,
}
/*
- * If still no clauses match this key, we're done; we don't want to
- * look at keys to its right.
+ * If still no clauses match this key, we're done; we don't want
+ * to look at keys to its right.
*/
if (clausegroup == NIL)
break;
@@ -744,7 +742,6 @@ match_clause_to_indexkey(RelOptInfo *rel,
if (!join)
{
-
/*
* Not considering joins, so check for clauses of the form:
* (indexkey operator constant) or (constant operator indexkey).
@@ -782,7 +779,6 @@ match_clause_to_indexkey(RelOptInfo *rel,
}
else
{
-
/*
* Check for an indexqual that could be handled by a nestloop
* join. We need the index key to be compared against an
@@ -921,7 +917,6 @@ indexable_operator(Expr *clause, Oid opclass, bool indexkey_on_left)
{
if (new_op != expr_op)
{
-
/*
* OK, we found a binary-compatible operator of the same name;
* now does it match the index?
@@ -1144,7 +1139,7 @@ static const StrategyNumber
* and a "simple clause" restriction.
*
* We have two strategies for determining whether one simple clause
- * implies another. A simple and general way is to see if they are
+ * implies another. A simple and general way is to see if they are
* equal(); this works for any kind of expression. (Actually, there
* is an implied assumption that the functions in the expression are
* cachable, ie dependent only on their input arguments --- but this
@@ -1187,8 +1182,8 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
return true;
/*
- * Can't do anything more unless they are both binary opclauses with
- * a Var on the left and a Const on the right.
+ * Can't do anything more unless they are both binary opclauses with a
+ * Var on the left and a Const on the right.
*/
if (!is_opclause((Node *) predicate))
return false;
@@ -1223,8 +1218,8 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
/*
* 1. Find a "btree" strategy number for the pred_op
*
- * The following assumes that any given operator will only be in a
- * single btree operator class. This is true at least for all the
+ * The following assumes that any given operator will only be in a single
+ * btree operator class. This is true at least for all the
* pre-defined operator classes. If it isn't true, then whichever
* operator class happens to be returned first for the given operator
* will be used to find the associated strategy numbers for the test.
@@ -1237,7 +1232,7 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
relation = heap_openr(AccessMethodOperatorRelationName, AccessShareLock);
scan = heap_beginscan(relation, false, SnapshotNow, 1, entry);
-
+
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
{
aform = (Form_pg_amop) GETSTRUCT(tuple);
@@ -1246,7 +1241,11 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
/* Get the predicate operator's btree strategy number (1 to 5) */
pred_strategy = (StrategyNumber) aform->amopstrategy;
Assert(pred_strategy >= 1 && pred_strategy <= 5);
- /* Remember which operator class this strategy number came from */
+
+ /*
+ * Remember which operator class this strategy number came
+ * from
+ */
opclass_id = aform->amopclaid;
break;
}
@@ -1457,8 +1456,8 @@ index_innerjoin(Query *root, RelOptInfo *rel, IndexOptInfo *index,
/*
* Note that we are making a pathnode for a single-scan indexscan;
- * therefore, both indexinfo and indexqual should be single-element
- * lists.
+ * therefore, both indexinfo and indexqual should be
+ * single-element lists.
*/
pathnode->indexinfo = makeList1(index);
pathnode->indexqual = makeList1(indexquals);
@@ -1516,7 +1515,6 @@ match_index_to_operand(int indexkey,
RelOptInfo *rel,
IndexOptInfo *index)
{
-
/*
* Ignore any RelabelType node above the indexkey. This is needed to
* be able to apply indexscanning in binary-compatible-operator cases.
@@ -1528,7 +1526,6 @@ match_index_to_operand(int indexkey,
if (index->indproc == InvalidOid)
{
-
/*
* Simple index.
*/
@@ -1860,7 +1857,6 @@ expand_indexqual_conditions(List *indexquals)
switch (expr_op)
{
-
/*
* LIKE and regex operators are not members of any index
* opclass, so if we find one in an indexqual list we can
@@ -2065,17 +2061,17 @@ prefix_quals(Var *leftop, Oid expr_op,
/*
* Given a leftop and a rightop, and a inet-class sup/sub operator,
* generate suitable indexqual condition(s). expr_op is the original
- * operator.
+ * operator.
*/
static List *
network_prefix_quals(Var *leftop, Oid expr_op, Datum rightop)
{
- bool is_eq;
- char *opr1name;
- Datum opr1right;
- Datum opr2right;
- Oid opr1oid;
- Oid opr2oid;
+ bool is_eq;
+ char *opr1name;
+ Datum opr1right;
+ Datum opr2right;
+ Oid opr1oid;
+ Oid opr2oid;
List *result;
Oid datatype;
Oper *op;
@@ -2084,30 +2080,30 @@ network_prefix_quals(Var *leftop, Oid expr_op, Datum rightop)
switch (expr_op)
{
case OID_INET_SUB_OP:
- datatype = INETOID;
- is_eq = false;
+ datatype = INETOID;
+ is_eq = false;
break;
case OID_INET_SUBEQ_OP:
- datatype = INETOID;
- is_eq = true;
+ datatype = INETOID;
+ is_eq = true;
break;
case OID_CIDR_SUB_OP:
- datatype = CIDROID;
- is_eq = false;
+ datatype = CIDROID;
+ is_eq = false;
break;
case OID_CIDR_SUBEQ_OP:
- datatype = CIDROID;
- is_eq = true;
+ datatype = CIDROID;
+ is_eq = true;
break;
default:
elog(ERROR, "network_prefix_quals: unexpected operator %u",
expr_op);
return NIL;
- }
+ }
/*
- * create clause "key >= network_scan_first( rightop )", or ">"
- * if the operator disallows equality.
+ * create clause "key >= network_scan_first( rightop )", or ">" if the
+ * operator disallows equality.
*/
opr1name = is_eq ? ">=" : ">";
@@ -2116,11 +2112,11 @@ network_prefix_quals(Var *leftop, Oid expr_op, Datum rightop)
elog(ERROR, "network_prefix_quals: no %s operator for type %u",
opr1name, datatype);
- opr1right = network_scan_first( rightop );
+ opr1right = network_scan_first(rightop);
op = makeOper(opr1oid, InvalidOid, BOOLOID);
- expr = make_opclause(op, leftop,
- (Var *) makeConst(datatype, -1, opr1right,
+ expr = make_opclause(op, leftop,
+ (Var *) makeConst(datatype, -1, opr1right,
false, false, false, false));
result = makeList1(expr);
@@ -2131,11 +2127,11 @@ network_prefix_quals(Var *leftop, Oid expr_op, Datum rightop)
elog(ERROR, "network_prefix_quals: no <= operator for type %u",
datatype);
- opr2right = network_scan_last( rightop );
+ opr2right = network_scan_last(rightop);
op = makeOper(opr2oid, InvalidOid, BOOLOID);
- expr = make_opclause(op, leftop,
- (Var *) makeConst(datatype, -1, opr2right,
+ expr = make_opclause(op, leftop,
+ (Var *) makeConst(datatype, -1, opr2right,
false, false, false, false));
result = lappend(result, expr);
diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c
index 5a0734224f2..15bb56757d1 100644
--- a/src/backend/optimizer/path/joinpath.c
+++ b/src/backend/optimizer/path/joinpath.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.65 2001/06/05 05:26:04 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.66 2001/10/25 05:49:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,7 +38,6 @@ static void match_unsorted_inner(Query *root, RelOptInfo *joinrel,
RelOptInfo *outerrel, RelOptInfo *innerrel,
List *restrictlist, List *mergeclause_list,
JoinType jointype);
-
#endif
static void hash_inner_and_outer(Query *root, RelOptInfo *joinrel,
RelOptInfo *outerrel, RelOptInfo *innerrel,
@@ -297,9 +296,9 @@ match_unsorted_outer(Query *root,
/*
* Nestloop only supports inner and left joins. Also, if we are doing
* a right or full join, we must use *all* the mergeclauses as join
- * clauses, else we will not have a valid plan. (Although these two flags
- * are currently inverses, keep them separate for clarity and possible
- * future changes.)
+ * clauses, else we will not have a valid plan. (Although these two
+ * flags are currently inverses, keep them separate for clarity and
+ * possible future changes.)
*/
switch (jointype)
{
@@ -316,7 +315,7 @@ match_unsorted_outer(Query *root,
default:
elog(ERROR, "match_unsorted_outer: unexpected join type %d",
(int) jointype);
- nestjoinOK = false; /* keep compiler quiet */
+ nestjoinOK = false; /* keep compiler quiet */
useallclauses = false;
break;
}
@@ -350,12 +349,11 @@ match_unsorted_outer(Query *root,
if (nestjoinOK)
{
-
/*
* Always consider a nestloop join with this outer and
* cheapest-total-cost inner. Consider nestloops using the
- * cheapest-startup-cost inner as well, and the best
- * innerjoin indexpath.
+ * cheapest-startup-cost inner as well, and the best innerjoin
+ * indexpath.
*/
add_path(joinrel, (Path *)
create_nestloop_path(root,
@@ -494,7 +492,6 @@ match_unsorted_outer(Query *root,
/* Found a cheap (or even-cheaper) sorted path */
if (innerpath != cheapest_total_inner)
{
-
/*
* Avoid rebuilding clause list if we already made
* one; saves memory in big join trees...
@@ -526,6 +523,7 @@ match_unsorted_outer(Query *root,
}
cheapest_startup_inner = innerpath;
}
+
/*
* Don't consider truncated sortkeys if we need all clauses.
*/
@@ -576,7 +574,7 @@ match_unsorted_inner(Query *root,
default:
elog(ERROR, "match_unsorted_inner: unexpected join type %d",
(int) jointype);
- useallclauses = false; /* keep compiler quiet */
+ useallclauses = false; /* keep compiler quiet */
break;
}
@@ -673,7 +671,6 @@ match_unsorted_inner(Query *root,
}
}
}
-
#endif
/*
diff --git a/src/backend/optimizer/path/joinrels.c b/src/backend/optimizer/path/joinrels.c
index 8c805e0e3ed..745a1eb0b5b 100644
--- a/src/backend/optimizer/path/joinrels.c
+++ b/src/backend/optimizer/path/joinrels.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.54 2001/10/18 16:11:41 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.55 2001/10/25 05:49:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -69,7 +69,6 @@ make_rels_by_joins(Query *root, int level, List **joinrels)
if (old_rel->joininfo != NIL)
{
-
/*
* Note that if all available join clauses for this rel
* require more than one other rel, we will fail to make any
@@ -84,7 +83,6 @@ make_rels_by_joins(Query *root, int level, List **joinrels)
}
else
{
-
/*
* Oops, we have a relation that is not joined to any other
* relation. Cartesian product time.
@@ -195,7 +193,6 @@ make_rels_by_joins(Query *root, int level, List **joinrels)
*/
if (result_rels == NIL)
{
-
/*
* This loop is just like the first one, except we always call
* make_rels_by_clauseless_joins().
diff --git a/src/backend/optimizer/path/orindxpath.c b/src/backend/optimizer/path/orindxpath.c
index 889a3afee12..b713dc8ad8c 100644
--- a/src/backend/optimizer/path/orindxpath.c
+++ b/src/backend/optimizer/path/orindxpath.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.44 2001/06/05 17:13:52 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.45 2001/10/25 05:49:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -175,7 +175,7 @@ best_or_subclause_indices(Query *root,
pathnode->indexinfo = lappend(pathnode->indexinfo, best_indexinfo);
pathnode->indexqual = lappend(pathnode->indexqual, best_indexqual);
- if (slist == subclauses) /* first scan? */
+ if (slist == subclauses)/* first scan? */
pathnode->path.startup_cost = best_startup_cost;
pathnode->path.total_cost += best_total_cost;
@@ -202,7 +202,7 @@ best_or_subclause_index(Query *root,
RelOptInfo *rel,
Expr *subclause,
List *indices,
- IndexOptInfo **retIndexInfo, /* return value */
+ IndexOptInfo **retIndexInfo, /* return value */
List **retIndexQual, /* return value */
Cost *retStartupCost, /* return value */
Cost *retTotalCost) /* return value */
diff --git a/src/backend/optimizer/path/pathkeys.c b/src/backend/optimizer/path/pathkeys.c
index 9e964290e6d..c7e13f2850f 100644
--- a/src/backend/optimizer/path/pathkeys.c
+++ b/src/backend/optimizer/path/pathkeys.c
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.33 2001/10/18 16:11:41 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.34 2001/10/25 05:49:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -109,7 +109,6 @@ add_equijoined_keys(Query *root, RestrictInfo *restrictinfo)
if (item1here || item2here)
{
-
/*
* If find both in same equivalence set, no need to do any
* more
@@ -318,7 +317,7 @@ compare_pathkeys(List *keys1, List *keys2)
if (key1 == NIL && key2 == NIL)
return PATHKEYS_EQUAL;
if (key1 != NIL)
- return PATHKEYS_BETTER1;/* key1 is longer */
+ return PATHKEYS_BETTER1; /* key1 is longer */
return PATHKEYS_BETTER2; /* key2 is longer */
}
@@ -368,7 +367,7 @@ compare_noncanonical_pathkeys(List *keys1, List *keys2)
if (key1 == NIL && key2 == NIL)
return PATHKEYS_EQUAL;
if (key1 != NIL)
- return PATHKEYS_BETTER1;/* key1 is longer */
+ return PATHKEYS_BETTER1; /* key1 is longer */
return PATHKEYS_BETTER2; /* key2 is longer */
}
@@ -382,8 +381,8 @@ pathkeys_contained_in(List *keys1, List *keys2)
{
switch (compare_pathkeys(keys1, keys2))
{
- case PATHKEYS_EQUAL:
- case PATHKEYS_BETTER2:
+ case PATHKEYS_EQUAL:
+ case PATHKEYS_BETTER2:
return true;
default:
break;
@@ -400,8 +399,8 @@ noncanonical_pathkeys_contained_in(List *keys1, List *keys2)
{
switch (compare_noncanonical_pathkeys(keys1, keys2))
{
- case PATHKEYS_EQUAL:
- case PATHKEYS_BETTER2:
+ case PATHKEYS_EQUAL:
+ case PATHKEYS_BETTER2:
return true;
default:
break;
@@ -632,7 +631,6 @@ build_join_pathkeys(Query *root,
RelOptInfo *joinrel,
List *outer_pathkeys)
{
-
/*
* This used to be quite a complex bit of code, but now that all
* pathkey sublists start out life canonicalized, we don't have to do
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index 8756fcc0205..30ddd8437cb 100644
--- a/src/backend/optimizer/plan/createplan.c
+++ b/src/backend/optimizer/plan/createplan.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.109 2001/09/21 04:06:04 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.110 2001/10/25 05:49:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,14 +57,14 @@ static HashJoin *create_hashjoin_plan(HashPath *best_path, List *tlist,
Plan *outer_plan, List *outer_tlist,
Plan *inner_plan, List *inner_tlist);
static void fix_indxqual_references(List *indexquals, IndexPath *index_path,
- List **fixed_indexquals,
- List **recheck_indexquals);
+ List **fixed_indexquals,
+ List **recheck_indexquals);
static void fix_indxqual_sublist(List *indexqual, int baserelid,
- IndexOptInfo *index,
- List **fixed_quals, List **recheck_quals);
+ IndexOptInfo *index,
+ List **fixed_quals, List **recheck_quals);
static Node *fix_indxqual_operand(Node *node, int baserelid,
- IndexOptInfo *index,
- Oid *opclass);
+ IndexOptInfo *index,
+ Oid *opclass);
static List *switch_outer(List *clauses);
static void copy_path_costsize(Plan *dest, Path *src);
static void copy_plan_costsize(Plan *dest, Plan *src);
@@ -410,9 +410,9 @@ create_indexscan_plan(Query *root,
/*
* The qpqual list must contain all restrictions not automatically
- * handled by the index. Normally the predicates in the indxqual
- * are checked fully by the index, but if the index is "lossy" for
- * a particular operator (as signaled by the amopreqcheck flag in
+ * handled by the index. Normally the predicates in the indxqual are
+ * checked fully by the index, but if the index is "lossy" for a
+ * particular operator (as signaled by the amopreqcheck flag in
* pg_amop), then we need to double-check that predicate in qpqual,
* because the index may return more tuples than match the predicate.
*
@@ -453,19 +453,19 @@ create_indexscan_plan(Query *root,
/*
* The executor needs a copy with the indexkey on the left of each
- * clause and with index attr numbers substituted for table ones.
- * This pass also looks for "lossy" operators.
+ * clause and with index attr numbers substituted for table ones. This
+ * pass also looks for "lossy" operators.
*/
fix_indxqual_references(indxqual, best_path,
&fixed_indxqual, &recheck_indxqual);
/*
- * If there were any "lossy" operators, need to add back the appropriate
- * qual clauses to the qpqual. When there is just one indexscan being
- * performed (ie, we have simple AND semantics), we can just add the
- * lossy clauses themselves to qpqual. If we have OR-of-ANDs, we'd
- * better add the entire original indexqual to make sure that the
- * semantics are correct.
+ * If there were any "lossy" operators, need to add back the
+ * appropriate qual clauses to the qpqual. When there is just one
+ * indexscan being performed (ie, we have simple AND semantics), we
+ * can just add the lossy clauses themselves to qpqual. If we have
+ * OR-of-ANDs, we'd better add the entire original indexqual to make
+ * sure that the semantics are correct.
*/
if (recheck_indxqual != NIL)
{
@@ -589,7 +589,6 @@ create_nestloop_plan(NestPath *best_path,
if (IsA(inner_plan, IndexScan))
{
-
/*
* An index is being used to reduce the number of tuples scanned
* in the inner relation. If there are join clauses being used
@@ -657,7 +656,6 @@ create_nestloop_plan(NestPath *best_path,
}
else if (IsA_Join(inner_plan))
{
-
/*
* Materialize the inner join for speed reasons.
*
@@ -900,7 +898,7 @@ create_hashjoin_plan(HashPath *best_path,
* left. (Someday the executor might not need this, but for now it does.)
* * If the indexable operator is marked 'amopreqcheck' in pg_amop, then
* the index is "lossy" for this operator: it may return more tuples than
- * actually satisfy the operator condition. For each such operator, we
+ * actually satisfy the operator condition. For each such operator, we
* must add (the original form of) the indexqual clause to the "qpquals"
* of the indexscan node, where the operator will be re-evaluated to
* ensure it passes.
@@ -922,7 +920,7 @@ create_hashjoin_plan(HashPath *best_path,
*/
static void
fix_indxqual_references(List *indexquals, IndexPath *index_path,
- List **fixed_indexquals, List **recheck_indexquals)
+ List **fixed_indexquals, List **recheck_indexquals)
{
List *fixed_quals = NIL;
List *recheck_quals = NIL;
@@ -992,7 +990,7 @@ fix_indxqual_sublist(List *indexqual, int baserelid, IndexOptInfo *index,
/*
* Check to see if the indexkey is on the right; if so, commute
- * the clause. The indexkey should be the side that refers to
+ * the clause. The indexkey should be the side that refers to
* (only) the base relation.
*/
leftvarnos = pull_varnos((Node *) lfirst(newclause->args));
@@ -1022,8 +1020,8 @@ fix_indxqual_sublist(List *indexqual, int baserelid, IndexOptInfo *index,
fixed_qual = lappend(fixed_qual, newclause);
/*
- * Finally, check to see if index is lossy for this operator.
- * If so, add (a copy of) original form of clause to recheck list.
+ * Finally, check to see if index is lossy for this operator. If
+ * so, add (a copy of) original form of clause to recheck list.
*/
if (op_requires_recheck(newopno, opclass))
recheck_qual = lappend(recheck_qual,
@@ -1038,7 +1036,6 @@ static Node *
fix_indxqual_operand(Node *node, int baserelid, IndexOptInfo *index,
Oid *opclass)
{
-
/*
* Remove any binary-compatible relabeling of the indexkey
*/
@@ -1088,7 +1085,7 @@ fix_indxqual_operand(Node *node, int baserelid, IndexOptInfo *index,
* the returned varattno must be 1.
*/
Assert(index->indproc != InvalidOid);
- Assert(is_funcclause(node)); /* not a very thorough check, but easy */
+ Assert(is_funcclause(node)); /* not a very thorough check, but easy */
/* classlist[0] is the only class of a functional index */
*opclass = index->classlist[0];
@@ -1119,7 +1116,6 @@ switch_outer(List *clauses)
Assert(op && IsA(op, Var));
if (var_is_outer(op))
{
-
/*
* Duplicate just enough of the structure to allow commuting
* the clause without changing the original list. Could use
@@ -1899,5 +1895,4 @@ generate_fjoin(List *tlist)
return newTlist;
return tlist; /* do nothing for now - ay 10/94 */
}
-
#endif
diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c
index ff2e13ec977..4c7e281866b 100644
--- a/src/backend/optimizer/plan/initsplan.c
+++ b/src/backend/optimizer/plan/initsplan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.64 2001/10/18 16:11:41 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.65 2001/10/25 05:49:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -46,7 +46,7 @@ static void add_join_info_to_rels(Query *root, RestrictInfo *restrictinfo,
Relids join_relids);
static void add_vars_to_targetlist(Query *root, List *vars);
static bool qual_is_redundant(Query *root, RestrictInfo *restrictinfo,
- List *restrictlist);
+ List *restrictlist);
static void check_mergejoinable(RestrictInfo *restrictinfo);
static void check_hashjoinable(RestrictInfo *restrictinfo);
@@ -312,10 +312,10 @@ mark_baserels_for_outer_join(Query *root, Relids rels, Relids outerrels)
/*
* Presently the executor cannot support FOR UPDATE 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 target rel is FOR UPDATE.
+ * 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 target rel is FOR UPDATE.
* It's sufficient to make this check once per rel, so do it only
* if rel wasn't already known nullable.
*/
@@ -411,9 +411,9 @@ distribute_qual_to_rels(Query *root, Node *clause,
* outerjoinset list of each baserel will show exactly those outer
* joins that are below the qual in the join tree.
*
- * If the qual came from implied-equality deduction, we can evaluate
- * the qual at its natural semantic level.
- *
+ * If the qual came from implied-equality deduction, we can evaluate the
+ * qual at its natural semantic level.
+ *
*/
if (isdeduced)
{
@@ -488,12 +488,13 @@ distribute_qual_to_rels(Query *root, Node *clause,
/*
* If the clause was deduced from implied equality, check to see
- * whether it is redundant with restriction clauses we already have
- * for this rel. Note we cannot apply this check to user-written
- * clauses, since we haven't found the canonical pathkey sets yet
- * while processing user clauses. (NB: no comparable check is done
- * in the join-clause case; redundancy will be detected when the
- * join clause is moved into a join rel's restriction list.)
+ * whether it is redundant with restriction clauses we already
+ * have for this rel. Note we cannot apply this check to
+ * user-written clauses, since we haven't found the canonical
+ * pathkey sets yet while processing user clauses. (NB: no
+ * comparable check is done in the join-clause case; redundancy
+ * will be detected when the join clause is moved into a join
+ * rel's restriction list.)
*/
if (!isdeduced ||
!qual_is_redundant(root, restrictinfo, rel->baserestrictinfo))
@@ -537,7 +538,6 @@ distribute_qual_to_rels(Query *root, Node *clause,
}
else
{
-
/*
* 'clause' references no rels, and therefore we have no place to
* attach it. Shouldn't get here if callers are working properly.
@@ -551,8 +551,8 @@ distribute_qual_to_rels(Query *root, Node *clause,
* the two sides represent equivalent PathKeyItems for path keys: any
* path that is sorted by one side will also be sorted by the other
* (as soon as the two rels are joined, that is). Record the key
- * equivalence for future use. (We can skip this for a deduced clause,
- * since the keys are already known equivalent in that case.)
+ * equivalence for future use. (We can skip this for a deduced
+ * clause, since the keys are already known equivalent in that case.)
*/
if (can_be_equijoin && restrictinfo->mergejoinoperator != InvalidOid &&
!isdeduced)
@@ -681,7 +681,6 @@ process_implied_equality(Query *root, Node *item1, Node *item2,
eq_operator = compatible_oper("=", ltype, rtype, true);
if (!HeapTupleIsValid(eq_operator))
{
-
/*
* Would it be safe to just not add the equality to the query if
* we have no suitable equality operator for the combination of
@@ -735,12 +734,12 @@ qual_is_redundant(Query *root,
RestrictInfo *restrictinfo,
List *restrictlist)
{
- List *oldquals;
- List *olditem;
- Node *newleft;
- Node *newright;
- List *equalvars;
- bool someadded;
+ List *oldquals;
+ List *olditem;
+ Node *newleft;
+ Node *newright;
+ List *equalvars;
+ bool someadded;
/*
* Set cached pathkeys. NB: it is okay to do this now because this
@@ -752,6 +751,7 @@ qual_is_redundant(Query *root,
/* If different, say "not redundant" (should never happen) */
if (restrictinfo->left_pathkey != restrictinfo->right_pathkey)
return false;
+
/*
* Scan existing quals to find those referencing same pathkeys.
* Usually there will be few, if any, so build a list of just the
@@ -772,24 +772,26 @@ qual_is_redundant(Query *root,
}
if (oldquals == NIL)
return false;
+
/*
* Now, we want to develop a list of Vars that are known equal to the
- * left side of the new qual. We traverse the old-quals list repeatedly
- * to transitively expand the Vars list. If at any point we find we
- * can reach the right-side Var of the new qual, we are done. We give
- * up when we can't expand the equalvars list any more.
+ * left side of the new qual. We traverse the old-quals list
+ * repeatedly to transitively expand the Vars list. If at any point
+ * we find we can reach the right-side Var of the new qual, we are
+ * done. We give up when we can't expand the equalvars list any more.
*/
newleft = (Node *) get_leftop(restrictinfo->clause);
newright = (Node *) get_rightop(restrictinfo->clause);
equalvars = makeList1(newleft);
- do {
+ do
+ {
someadded = false;
foreach(olditem, oldquals)
{
RestrictInfo *oldrinfo = (RestrictInfo *) lfirst(olditem);
- Node *oldleft = (Node *) get_leftop(oldrinfo->clause);
- Node *oldright = (Node *) get_rightop(oldrinfo->clause);
- Node *newguy = NULL;
+ Node *oldleft = (Node *) get_leftop(oldrinfo->clause);
+ Node *oldright = (Node *) get_rightop(oldrinfo->clause);
+ Node *newguy = NULL;
if (member(oldleft, equalvars))
newguy = oldright;
@@ -801,6 +803,7 @@ qual_is_redundant(Query *root,
return true; /* we proved new clause is redundant */
equalvars = lcons(newguy, equalvars);
someadded = true;
+
/*
* Remove this qual from list, since we don't need it anymore.
* Note this doesn't break the foreach() loop, since lremove
diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c
index b5a77ea6232..57c9b963c73 100644
--- a/src/backend/optimizer/plan/planmain.c
+++ b/src/backend/optimizer/plan/planmain.c
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.66 2001/06/05 05:26:04 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.67 2001/10/25 05:49:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -137,7 +137,6 @@ query_planner(Query *root,
*/
if (constant_quals || IsA(subplan, Append))
{
-
/*
* The result node will also be responsible for evaluating the
* originally requested tlist.
@@ -148,7 +147,6 @@ query_planner(Query *root,
}
else
{
-
/*
* Replace the toplevel plan node's flattened target list with the
* targetlist given by my caller, so that expressions are
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 48e41686e9b..d870b2786fb 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.109 2001/10/18 16:11:41 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.110 2001/10/25 05:49:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -210,7 +210,7 @@ subquery_planner(Query *parse, double tuple_fraction)
* grouping_planner.
*/
if (parse->resultRelation &&
- (lst = expand_inherted_rtentry(parse, parse->resultRelation, false))
+ (lst = expand_inherted_rtentry(parse, parse->resultRelation, false))
!= NIL)
plan = inheritance_planner(parse, lst);
else
@@ -277,8 +277,8 @@ pull_up_subqueries(Query *parse, Node *jtnode)
* Is this a subquery RTE, and if so, is the subquery simple
* enough to pull up? (If not, do nothing at this node.)
*
- * Note: even if the subquery itself is simple enough, we can't
- * pull it up if there is a reference to its whole tuple result.
+ * Note: even if the subquery itself is simple enough, we can't pull
+ * it up if there is a reference to its whole tuple result.
*/
if (subquery && is_simple_subquery(subquery) &&
!contain_whole_tuple_var((Node *) parse, varno, 0))
@@ -370,12 +370,13 @@ pull_up_subqueries(Query *parse, Node *jtnode)
/*
* At the moment, we can't pull up subqueries that are inside the
- * nullable side of an outer join, because substituting their target
- * list entries for upper Var references wouldn't do the right thing
- * (the entries wouldn't go to NULL when they're supposed to).
- * Suppressing the pullup is an ugly, performance-losing hack, but
- * I see no alternative for now. Find a better way to handle this
- * when we redesign query trees --- tgl 4/30/01.
+ * nullable side of an outer join, because substituting their
+ * target list entries for upper Var references wouldn't do the
+ * right thing (the entries wouldn't go to NULL when they're
+ * supposed to). Suppressing the pullup is an ugly,
+ * performance-losing hack, but I see no alternative for now.
+ * Find a better way to handle this when we redesign query trees
+ * --- tgl 4/30/01.
*/
switch (j->jointype)
{
@@ -392,6 +393,7 @@ pull_up_subqueries(Query *parse, Node *jtnode)
j->rarg = pull_up_subqueries(parse, j->rarg);
break;
case JOIN_UNION:
+
/*
* This is where we fail if upper levels of planner
* haven't rewritten UNION JOIN as an Append ...
@@ -418,7 +420,6 @@ pull_up_subqueries(Query *parse, Node *jtnode)
static bool
is_simple_subquery(Query *subquery)
{
-
/*
* Let's just make sure it's a valid subselect ...
*/
@@ -545,7 +546,6 @@ preprocess_jointree(Query *parse, Node *jtnode)
/* Now, is it a FromExpr? */
if (child && IsA(child, FromExpr))
{
-
/*
* Yes, so do we want to merge it into parent? Always do
* so if child has just one element (since that doesn't
@@ -596,7 +596,6 @@ preprocess_jointree(Query *parse, Node *jtnode)
static Node *
preprocess_expression(Query *parse, Node *expr, int kind)
{
-
/*
* Simplify constant expressions.
*
@@ -632,7 +631,6 @@ preprocess_expression(Query *parse, Node *expr, int kind)
if (kind != EXPRKIND_WHERE &&
(parse->groupClause != NIL || parse->hasAggs))
{
-
/*
* Check for ungrouped variables passed to subplans. Note we
* do NOT do this for subplans in WHERE (or JOIN/ON); it's
@@ -776,7 +774,6 @@ grouping_planner(Query *parse, double tuple_fraction)
if (parse->setOperations)
{
-
/*
* Construct the plan for set operations. The result will not
* need any work except perhaps a top-level sort and/or LIMIT.
@@ -946,12 +943,12 @@ grouping_planner(Query *parse, double tuple_fraction)
if (parse->limitCount != NULL)
{
/*
- * A LIMIT clause limits the absolute number of tuples returned.
- * However, if it's not a constant LIMIT then we have to punt;
- * for lack of a better idea, assume 10% of the plan's result
- * is wanted.
+ * A LIMIT clause limits the absolute number of tuples
+ * returned. However, if it's not a constant LIMIT then we
+ * have to punt; for lack of a better idea, assume 10% of the
+ * plan's result is wanted.
*/
- double limit_fraction = 0.0;
+ double limit_fraction = 0.0;
if (IsA(parse->limitCount, Const))
{
@@ -959,9 +956,9 @@ grouping_planner(Query *parse, double tuple_fraction)
int32 count = DatumGetInt32(limitc->constvalue);
/*
- * A NULL-constant LIMIT represents "LIMIT ALL", which
- * we treat the same as no limit (ie, expect to
- * retrieve all the tuples).
+ * A NULL-constant LIMIT represents "LIMIT ALL", which we
+ * treat the same as no limit (ie, expect to retrieve all
+ * the tuples).
*/
if (!limitc->constisnull && count > 0)
{
@@ -996,9 +993,10 @@ grouping_planner(Query *parse, double tuple_fraction)
{
/*
* If we have absolute limits from both caller and LIMIT,
- * use the smaller value; if one is fractional and the other
- * absolute, treat the fraction as a fraction of the absolute
- * value; else we can multiply the two fractions together.
+ * use the smaller value; if one is fractional and the
+ * other absolute, treat the fraction as a fraction of the
+ * absolute value; else we can multiply the two fractions
+ * together.
*/
if (tuple_fraction >= 1.0)
{
@@ -1040,7 +1038,6 @@ grouping_planner(Query *parse, double tuple_fraction)
if (parse->groupClause)
{
-
/*
* In GROUP BY mode, we have the little problem that we don't
* really know how many input tuples will be needed to make a
@@ -1069,7 +1066,6 @@ grouping_planner(Query *parse, double tuple_fraction)
}
else if (parse->hasAggs)
{
-
/*
* Ungrouped aggregate will certainly want all the input
* tuples.
@@ -1078,7 +1074,6 @@ grouping_planner(Query *parse, double tuple_fraction)
}
else if (parse->distinctClause)
{
-
/*
* SELECT DISTINCT, like GROUP, will absorb an unpredictable
* number of input tuples per output tuple. Handle the same
@@ -1147,7 +1142,6 @@ grouping_planner(Query *parse, double tuple_fraction)
}
else
{
-
/*
* We will need to do an explicit sort by the GROUP BY clause.
* make_groupplan will do the work, but set current_pathkeys
@@ -1346,7 +1340,6 @@ make_groupplan(Query *parse,
if (!is_presorted)
{
-
/*
* The Sort node always just takes a copy of the subplan's tlist
* plus ordering information. (This might seem inefficient if the
diff --git a/src/backend/optimizer/prep/prepkeyset.c b/src/backend/optimizer/prep/prepkeyset.c
index 180637d099e..6ff40fdb082 100644
--- a/src/backend/optimizer/prep/prepkeyset.c
+++ b/src/backend/optimizer/prep/prepkeyset.c
@@ -216,5 +216,4 @@ inspectOpNode(Expr *expr)
secondExpr = lsecond(expr->args);
return (firstExpr && secondExpr && nodeTag(firstExpr) == T_Var && nodeTag(secondExpr) == T_Const);
}
-
#endif /* ENABLE_KEY_SET_QUERY */
diff --git a/src/backend/optimizer/prep/prepqual.c b/src/backend/optimizer/prep/prepqual.c
index 2dc92deca17..a7773040d79 100644
--- a/src/backend/optimizer/prep/prepqual.c
+++ b/src/backend/optimizer/prep/prepqual.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepqual.c,v 1.29 2001/03/22 03:59:38 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepqual.c,v 1.30 2001/10/25 05:49:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -157,7 +157,6 @@ canonicalize_qual(Expr *qual, bool removeAndFlag)
*/
if (cnfok)
{
-
/*
* Normalize into conjunctive normal form, and clean up the
* result.
@@ -166,7 +165,6 @@ canonicalize_qual(Expr *qual, bool removeAndFlag)
}
else if (dnfok)
{
-
/*
* Normalize into disjunctive normal form, and clean up the
* result.
@@ -260,7 +258,6 @@ dnfify(Expr *qual)
return newqual;
}
-
#endif
/*--------------------
@@ -539,7 +536,6 @@ push_nots(Expr *qual)
}
else if (not_clause((Node *) qual))
{
-
/*
* Another 'not' cancels this 'not', so eliminate the 'not' and
* stop negating this branch. But search the subexpression for
@@ -549,7 +545,6 @@ push_nots(Expr *qual)
}
else
{
-
/*
* We don't know how to negate anything else, place a 'not' at
* this level.
@@ -959,7 +954,6 @@ count_bool_nodes(Expr *qual,
}
else if (contain_subplans((Node *) qual))
{
-
/*
* charge extra for subexpressions containing sub-SELECTs, to
* discourage us from rearranging them in a way that might
diff --git a/src/backend/optimizer/prep/preptlist.c b/src/backend/optimizer/prep/preptlist.c
index 737f624b5aa..2e335b808b7 100644
--- a/src/backend/optimizer/prep/preptlist.c
+++ b/src/backend/optimizer/prep/preptlist.c
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.43 2001/09/06 02:07:42 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.44 2001/10/25 05:49:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -49,7 +49,6 @@ preprocess_targetlist(List *tlist,
Index result_relation,
List *range_table)
{
-
/*
* Sanity check: if there is a result relation, it'd better be a real
* relation not a subquery. Else parser or rewriter messed up.
@@ -175,7 +174,6 @@ expand_targetlist(List *tlist, int command_type,
if (new_tle == NULL)
{
-
/*
* Didn't find a matching tlist entry, so make one.
*
@@ -203,7 +201,8 @@ expand_targetlist(List *tlist, int command_type,
/*
* Set attributes are represented as OIDs no
* matter what the set element type is, and
- * the element type's default is irrelevant too.
+ * the element type's default is irrelevant
+ * too.
*/
hasdefault = false;
typedefault = (Datum) 0;
@@ -335,7 +334,6 @@ process_matched_tle(TargetEntry *src_tle,
if (prior_tle == NULL)
{
-
/*
* Normal case where this is the first assignment to the
* attribute.
diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c
index dbbe004aef2..6949217decb 100644
--- a/src/backend/optimizer/prep/prepunion.c
+++ b/src/backend/optimizer/prep/prepunion.c
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.66 2001/08/14 17:12:57 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.67 2001/10/25 05:49:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -275,7 +275,7 @@ generate_nonunion_plan(SetOperationStmt *op, Query *parse,
*
* The tlist for an Append plan isn't important as far as the Append is
* concerned, but we must make it look real anyway for the benefit of
- * the next plan level up. In fact, it has to be real enough that the
+ * the next plan level up. In fact, it has to be real enough that the
* flag column is shown as a variable not a constant, else setrefs.c
* will get confused.
*/
@@ -358,7 +358,7 @@ recurse_union_children(Node *setOp, Query *parse,
*
* colTypes: column datatypes for non-junk columns
* flag: -1 if no flag column needed, 0 or 1 to create a const flag column,
- * 2 to create a variable flag column
+ * 2 to create a variable flag column
* hack_constants: true to copy up constants (see comments in code)
* input_tlist: targetlist of this node's input node
* refnames_tlist: targetlist to take column names from
@@ -538,7 +538,7 @@ find_all_inheritors(Oid parentrel)
* If not, return NIL.
*
* When dup_parent is false, the initially given RT index is part of the
- * returned list (if any). When dup_parent is true, the given RT index
+ * returned list (if any). When dup_parent is true, the given RT index
* is *not* in the returned list; a duplicate RTE will be made for the
* parent table.
*
@@ -571,6 +571,7 @@ expand_inherted_rtentry(Query *parse, Index rti, bool dup_parent)
return NIL;
/* Scan for all members of inheritance set */
inhOIDs = find_all_inheritors(parentOID);
+
/*
* Check that there's at least one descendant, else treat as no-child
* case. This could happen despite above has_subclass() check, if
@@ -582,7 +583,7 @@ expand_inherted_rtentry(Query *parse, Index rti, bool dup_parent)
if (dup_parent)
inhRTIs = NIL;
else
- inhRTIs = makeListi1(rti); /* include original RTE in result */
+ inhRTIs = makeListi1(rti); /* include original RTE in result */
foreach(l, inhOIDs)
{
@@ -728,10 +729,10 @@ adjust_inherited_attrs_mutator(Node *node,
/*
* BUT: although we don't need to recurse into subplans, we do need to
* make sure that they are copied, not just referenced as
- * expression_tree_mutator will do by default. Otherwise we'll have the
- * same subplan node referenced from each arm of the inheritance APPEND
- * plan, which will cause trouble in the executor. This is a kluge
- * that should go away when we redesign querytrees.
+ * expression_tree_mutator will do by default. Otherwise we'll have
+ * the same subplan node referenced from each arm of the inheritance
+ * APPEND plan, which will cause trouble in the executor. This is a
+ * kluge that should go away when we redesign querytrees.
*/
if (is_subplan(node))
{
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index 0bf06c52867..c92581082b2 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.88 2001/07/31 20:16:33 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.89 2001/10/25 05:49:34 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -354,7 +354,6 @@ make_ands_explicit(List *andclauses)
List *
make_ands_implicit(Expr *clause)
{
-
/*
* NB: because the parser sets the qual field to NULL in a query that
* has no WHERE clause, we must consider a NULL input clause as TRUE,
@@ -526,7 +525,6 @@ void
check_subplans_for_ungrouped_vars(Node *clause,
Query *query)
{
-
/*
* No special setup needed; context for walker is just the Query
* pointer
@@ -555,7 +553,6 @@ check_subplans_for_ungrouped_vars_walker(Node *node,
*/
if (is_subplan(node))
{
-
/*
* The args list of the subplan node represents attributes from
* outside passed into the sublink.
@@ -686,7 +683,6 @@ contain_noncachable_functions_walker(Node *node, void *context)
bool
is_pseudo_constant_clause(Node *clause)
{
-
/*
* We could implement this check in one recursive scan. But since the
* check for noncachable functions is both moderately expensive and
@@ -746,7 +742,7 @@ pull_constant_clauses(List *quals, List **constantQual)
static bool
sortgroupref_is_present(Index sortgroupref, List *clauselist)
{
- List *clause;
+ List *clause;
foreach(clause, clauselist)
{
@@ -765,20 +761,21 @@ sortgroupref_is_present(Index sortgroupref, List *clauselist)
bool
has_distinct_on_clause(Query *query)
{
- List *targetList;
+ List *targetList;
/* Is there a DISTINCT clause at all? */
if (query->distinctClause == NIL)
return false;
+
/*
- * If the DISTINCT list contains all the nonjunk targetlist items,
- * and nothing else (ie, no junk tlist items), then it's a simple
+ * If the DISTINCT list contains all the nonjunk targetlist items, and
+ * nothing else (ie, no junk tlist items), then it's a simple
* DISTINCT, else it's DISTINCT ON. We do not require the lists to be
* in the same order (since the parser may have adjusted the DISTINCT
- * clause ordering to agree with ORDER BY). Furthermore, a non-DISTINCT
- * junk tlist item that is in the sortClause is also evidence of
- * DISTINCT ON, since we don't allow ORDER BY on junk tlist items when
- * plain DISTINCT is used.
+ * clause ordering to agree with ORDER BY). Furthermore, a
+ * non-DISTINCT junk tlist item that is in the sortClause is also
+ * evidence of DISTINCT ON, since we don't allow ORDER BY on junk
+ * tlist items when plain DISTINCT is used.
*
* This code assumes that the DISTINCT list is valid, ie, all its entries
* match some entry of the tlist.
@@ -1155,7 +1152,6 @@ eval_const_expressions_mutator(Node *node, void *context)
}
if (IsA(node, RelabelType))
{
-
/*
* If we can simplify the input to a constant, then we don't need
* the RelabelType node anymore: just change the type field of the
@@ -1272,7 +1268,6 @@ eval_const_expressions_mutator(Node *node, void *context)
}
if (IsA(node, Iter))
{
-
/*
* The argument of an Iter is normally a function call. We must
* not try to eliminate the function, but we can try to simplify
@@ -1423,7 +1418,6 @@ simplify_op_or_func(Expr *expr, List *args)
*/
if (proisstrict && has_null_input)
{
-
/*
* It's strict and has NULL input, so must produce NULL output.
* Return a NULL constant of the right type.
@@ -1871,7 +1865,6 @@ expression_tree_mutator(Node *node,
Node *(*mutator) (),
void *context)
{
-
/*
* The mutator has already decided not to modify the current node, but
* we must call the mutator for any sub-nodes.
@@ -1933,7 +1926,6 @@ expression_tree_mutator(Node *node,
}
else
{
-
/*
* for other Expr node types, just transform args
* list, linking to original oper node (OK?)
@@ -2026,8 +2018,8 @@ expression_tree_mutator(Node *node,
break;
case T_NullTest:
{
- NullTest *ntest = (NullTest *) node;
- NullTest *newnode;
+ NullTest *ntest = (NullTest *) node;
+ NullTest *newnode;
FLATCOPY(newnode, ntest, NullTest);
MUTATE(newnode->arg, ntest->arg, Node *);
@@ -2046,7 +2038,6 @@ expression_tree_mutator(Node *node,
break;
case T_SubLink:
{
-
/*
* A "bare" SubLink (note we will not come here if we
* found a SUBPLAN_EXPR node above it). Transform the
@@ -2062,7 +2053,6 @@ expression_tree_mutator(Node *node,
break;
case T_List:
{
-
/*
* We assume the mutator isn't interested in the list
* nodes per se, so just invoke it on each list element.
@@ -2083,7 +2073,6 @@ expression_tree_mutator(Node *node,
break;
case T_TargetEntry:
{
-
/*
* We mutate the expression, but not the resdom, by
* default.
diff --git a/src/backend/optimizer/util/joininfo.c b/src/backend/optimizer/util/joininfo.c
index ec98dbcb24f..f12c9b70ba4 100644
--- a/src/backend/optimizer/util/joininfo.c
+++ b/src/backend/optimizer/util/joininfo.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.29 2001/03/22 03:59:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.30 2001/10/25 05:49:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -59,7 +59,7 @@ joininfo_member(List *join_relids, List *joininfo_list)
* Returns a joininfo node.
*
*/
-JoinInfo *
+JoinInfo *
find_joininfo_node(RelOptInfo *this_rel, Relids join_relids)
{
JoinInfo *joininfo = joininfo_member(join_relids,
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index 1377fc06a49..c86ee450082 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.75 2001/07/16 05:06:58 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.76 2001/10/25 05:49:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -325,7 +325,7 @@ create_seqscan_path(Query *root, RelOptInfo *rel)
*
* Returns the new path node.
*/
-IndexPath *
+IndexPath *
create_index_path(Query *root,
RelOptInfo *rel,
IndexOptInfo *index,
@@ -363,8 +363,8 @@ create_index_path(Query *root,
pathnode->rows = rel->rows;
/*
- * Not sure if this is necessary, but it should help if the
- * statistics are too far off
+ * Not sure if this is necessary, but it should help if the statistics
+ * are too far off
*/
if (index->indpred && index->tuples < pathnode->rows)
pathnode->rows = index->tuples;
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c
index 6d609853aa4..86ebb09ff67 100644
--- a/src/backend/optimizer/util/plancat.c
+++ b/src/backend/optimizer/util/plancat.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.68 2001/08/21 16:36:03 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.69 2001/10/25 05:49:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -115,8 +115,8 @@ find_secondary_indexes(Oid relationObjectId)
info = makeNode(IndexOptInfo);
/*
- * Need to make these arrays large enough to be sure there is
- * room for a terminating 0 at the end of each one.
+ * Need to make these arrays large enough to be sure there is room
+ * for a terminating 0 at the end of each one.
*/
info->classlist = (Oid *) palloc(sizeof(Oid) * (INDEX_MAX_KEYS + 1));
info->indexkeys = (int *) palloc(sizeof(int) * (INDEX_MAX_KEYS + 1));
@@ -125,7 +125,7 @@ find_secondary_indexes(Oid relationObjectId)
/* Extract info from the pg_index tuple */
info->indexoid = index->indexrelid;
info->indproc = index->indproc; /* functional index ?? */
- if (VARSIZE(&index->indpred) > VARHDRSZ) /* partial index ?? */
+ if (VARSIZE(&index->indpred) > VARHDRSZ) /* partial index ?? */
{
char *predString;
@@ -210,7 +210,7 @@ find_secondary_indexes(Oid relationObjectId)
* This code executes registered procedures stored in the
* operator relation, by calling the function manager.
*
- * varRelid is either 0 or a rangetable index. See clause_selectivity()
+ * varRelid is either 0 or a rangetable index. See clause_selectivity()
* for details about its meaning.
*/
Selectivity
@@ -223,8 +223,8 @@ restriction_selectivity(Query *root,
float8 result;
/*
- * if the oprrest procedure is missing for whatever reason,
- * use a selectivity of 0.5
+ * if the oprrest procedure is missing for whatever reason, use a
+ * selectivity of 0.5
*/
if (!oprrest)
return (Selectivity) 0.5;
@@ -257,8 +257,8 @@ join_selectivity(Query *root,
float8 result;
/*
- * if the oprjoin procedure is missing for whatever reason,
- * use a selectivity of 0.5
+ * if the oprjoin procedure is missing for whatever reason, use a
+ * selectivity of 0.5
*/
if (!oprjoin)
return (Selectivity) 0.5;
@@ -365,10 +365,10 @@ has_unique_index(RelOptInfo *rel, AttrNumber attno)
IndexOptInfo *index = (IndexOptInfo *) lfirst(ilist);
/*
- * Note: ignore functional and partial indexes, since they
- * don't allow us to conclude that all attr values are distinct.
- * Also, a multicolumn unique index doesn't allow us to conclude
- * that just the specified attr is unique.
+ * Note: ignore functional and partial indexes, since they don't
+ * allow us to conclude that all attr values are distinct. Also, a
+ * multicolumn unique index doesn't allow us to conclude that just
+ * the specified attr is unique.
*/
if (index->unique &&
index->nkeys == 1 &&
diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c
index 3b85f321dfb..457826f5d31 100644
--- a/src/backend/optimizer/util/relnode.c
+++ b/src/backend/optimizer/util/relnode.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.34 2001/10/18 16:11:42 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.35 2001/10/25 05:49:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,9 +26,9 @@
static RelOptInfo *make_base_rel(Query *root, int relid);
static List *new_join_tlist(List *tlist, int first_resdomno);
static List *build_joinrel_restrictlist(Query *root,
- RelOptInfo *joinrel,
- RelOptInfo *outer_rel,
- RelOptInfo *inner_rel);
+ RelOptInfo *joinrel,
+ RelOptInfo *outer_rel,
+ RelOptInfo *inner_rel);
static void build_joinrel_joinlist(RelOptInfo *joinrel,
RelOptInfo *outer_rel,
RelOptInfo *inner_rel);
@@ -154,7 +154,7 @@ make_base_rel(Query *root, int relid)
if (relationObjectId != InvalidOid)
{
/* Plain relation --- retrieve statistics from the system catalogs */
- bool indexed;
+ bool indexed;
get_relation_info(relationObjectId,
&indexed, &rel->pages, &rel->tuples);
@@ -270,7 +270,6 @@ build_join_rel(Query *root,
if (joinrel)
{
-
/*
* Yes, so we only need to figure the restrictlist for this
* particular pair of component relations.
@@ -437,9 +436,9 @@ build_joinrel_restrictlist(Query *root,
RelOptInfo *outer_rel,
RelOptInfo *inner_rel)
{
- List *result = NIL;
- List *rlist;
- List *item;
+ List *result = NIL;
+ List *rlist;
+ List *item;
/*
* Collect all the clauses that syntactically belong at this level.
@@ -453,9 +452,9 @@ build_joinrel_restrictlist(Query *root,
* Eliminate duplicate and redundant clauses.
*
* We must eliminate duplicates, since we will see many of the same
- * clauses arriving from both input relations. Also, if a clause is
- * a mergejoinable clause, it's possible that it is redundant with
- * previous clauses (see optimizer/README for discussion). We detect
+ * clauses arriving from both input relations. Also, if a clause is a
+ * mergejoinable clause, it's possible that it is redundant with
+ * previous clauses (see optimizer/README for discussion). We detect
* that case and omit the redundant clause from the result list.
*
* We can detect redundant mergejoinable clauses very cheaply by using
@@ -463,8 +462,9 @@ build_joinrel_restrictlist(Query *root,
* equijoined variables in question. All the members of a pathkey set
* that are in the left relation have already been forced to be equal;
* likewise for those in the right relation. So, we need to have only
- * one clause that checks equality between any set member on the left and
- * any member on the right; by transitivity, all the rest are then equal.
+ * one clause that checks equality between any set member on the left
+ * and any member on the right; by transitivity, all the rest are then
+ * equal.
*/
foreach(item, rlist)
{
@@ -477,8 +477,8 @@ build_joinrel_restrictlist(Query *root,
/* check for redundant merge clauses */
if (rinfo->mergejoinoperator != InvalidOid)
{
- bool redundant = false;
- List *olditem;
+ bool redundant = false;
+ List *olditem;
cache_mergeclause_pathkeys(root, rinfo);
diff --git a/src/backend/optimizer/util/tlist.c b/src/backend/optimizer/util/tlist.c
index 9d5d6c080e7..0d30586fce1 100644
--- a/src/backend/optimizer/util/tlist.c
+++ b/src/backend/optimizer/util/tlist.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.50 2001/03/22 03:59:40 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.51 2001/10/25 05:49:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -60,7 +60,6 @@ matching_tlist_expr(Node *node, List *targetlist)
return (Node *) NULL;
}
-
#endif
/*
diff --git a/src/backend/optimizer/util/var.c b/src/backend/optimizer/util/var.c
index 9b620c80f5a..2521ffb2b6c 100644
--- a/src/backend/optimizer/util/var.c
+++ b/src/backend/optimizer/util/var.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.32 2001/05/09 23:13:35 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.33 2001/10/25 05:49:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -41,7 +41,7 @@ typedef struct
static bool pull_varnos_walker(Node *node,
pull_varnos_context *context);
static bool contain_var_reference_walker(Node *node,
- contain_var_reference_context *context);
+ contain_var_reference_context *context);
static bool contain_var_clause_walker(Node *node, void *context);
static bool pull_var_clause_walker(Node *node,
pull_var_clause_context *context);
@@ -55,7 +55,7 @@ static bool pull_var_clause_walker(Node *node,
*
* NOTE: this is used on not-yet-planned expressions. It may therefore find
* bare SubLinks, and if so it needs to recurse into them to look for uplevel
- * references to the desired rtable level! But when we find a completed
+ * references to the desired rtable level! But when we find a completed
* SubPlan, we only need to look at the parameters passed to the subplan.
*/
List *
@@ -96,7 +96,6 @@ pull_varnos_walker(Node *node, pull_varnos_context *context)
}
if (is_subplan(node))
{
-
/*
* Already-planned subquery. Examine the args list (parameters to
* be passed to subquery), as well as the "oper" list which is
@@ -137,7 +136,7 @@ pull_varnos_walker(Node *node, pull_varnos_context *context)
*
* NOTE: this is used on not-yet-planned expressions. It may therefore find
* bare SubLinks, and if so it needs to recurse into them to look for uplevel
- * references to the desired rtable entry! But when we find a completed
+ * references to the desired rtable entry! But when we find a completed
* SubPlan, we only need to look at the parameters passed to the subplan.
*/
bool
@@ -180,7 +179,6 @@ contain_var_reference_walker(Node *node,
}
if (is_subplan(node))
{
-
/*
* Already-planned subquery. Examine the args list (parameters to
* be passed to subquery), as well as the "oper" list which is