1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-15 03:41:20 +03:00

Remove un-needed braces around single statements.

This commit is contained in:
Bruce Momjian
1998-06-15 19:30:31 +00:00
parent 27db9ecd0b
commit 6bd323c6b3
224 changed files with 221 additions and 2504 deletions

View File

@@ -3,7 +3,7 @@
* geqo_erx.c--
* edge recombination crossover [ER]
*
* $Id: geqo_erx.c,v 1.8 1998/02/26 04:32:20 momjian Exp $
* $Id: geqo_erx.c,v 1.9 1998/06/15 19:28:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -228,9 +228,7 @@ gimme_tour(Edge *edge_table, Gene *new_gene, int num_gene)
/* find destination for the newly entered point */
if (edge_table[new_gene[i - 1]].unused_edges > 0)
{
new_gene[i] = gimme_gene(edge_table[(int) new_gene[i - 1]], edge_table);
}
else
{ /* cope with fault */

View File

@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_eval.c,v 1.18 1998/02/26 04:32:21 momjian Exp $
* $Id: geqo_eval.c,v 1.19 1998/06/15 19:28:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -131,9 +131,7 @@ gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, Rel *outer_rel)
new_rels = lcons(gimme_clauseless_join(outer_rel, outer_rel), NIL); /* ??? MAU */
}
else
{
new_rels = lcons(gimme_clauseless_join(outer_rel, inner_rel), NIL);
}
}
/* process new_rel->pathlist */
@@ -221,9 +219,7 @@ gimme_clause_joins(Query *root, Rel *outer_rel, Rel *inner_rel)
rel = init_join_rel(outer_rel, get_join_rel(root, other_rels), joininfo);
}
else
{
rel = NULL;
}
if (rel != NULL)
join_list = lappend(join_list, rel);
@@ -700,18 +696,12 @@ geqo_joinrel_size(Rel *joinrel, Rel *outer_rel, Rel *inner_rel)
temp = (Cost) inner_rel->tuples * (Cost) outer_rel->tuples; /* cartesian product */
if (joinrel->clauseinfo)
{
temp = temp * product_selec(joinrel->clauseinfo);
}
if (temp >= (MAXINT - 1))
{
ntuples = ceil(geqo_log((double) temp, (double) GEQO_LOG_BASE));
}
else
{
ntuples = ceil((double) temp);
}
if (ntuples < 1)
ntuples = 1; /* make the best case 1 instead of 0 */

View File

@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_misc.c,v 1.7 1998/01/07 21:03:44 momjian Exp $
* $Id: geqo_misc.c,v 1.8 1998/06/15 19:28:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -269,16 +269,12 @@ geqo_print_rel(Query *root, Rel *rel)
printf("______________________________\n");
printf("(");
foreach(l, rel->relids)
{
printf("%d ", lfirsti(l));
}
printf("): size=%d width=%d\n", rel->size, rel->width);
printf("\tpath list:\n");
foreach(l, rel->pathlist)
{
geqo_print_path(root, lfirst(l), 1);
}
printf("\tcheapest path:\n");
geqo_print_path(root, rel->cheapestpath, 1);

View File

@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_params.c,v 1.8 1997/09/08 21:44:30 momjian Exp $
* $Id: geqo_params.c,v 1.9 1998/06/15 19:28:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -205,9 +205,7 @@ geqo_params(int string_length)
}
else
{
elog(DEBUG, "geqo_params: ga parameter file\n\'%s\'\ndoes not exist or permissions are not setup correctly", conf_file);
}
/*
* parameter checkings follow
@@ -317,13 +315,9 @@ gimme_pool_size(int string_length)
size = pow(2.0, exponent);
if (size < MIN_POOL)
{
return (MIN_POOL);
}
else if (size > MAX_POOL)
{
return (MAX_POOL);
}
else
return ((int) ceil(size));
}

View File

@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_paths.c,v 1.8 1998/02/26 04:32:23 momjian Exp $
* $Id: geqo_paths.c,v 1.9 1998/06/15 19:28:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -147,9 +147,7 @@ set_paths(Rel *rel, Path *unorderedpath)
rel->pathlist = lremove(unorderedpath, rel->pathlist);
}
else
{
rel->unorderedpath = (Path *) unorderedpath;
}
return (cheapest);
}

View File

@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_pool.c,v 1.7 1998/04/06 02:38:04 momjian Exp $
* $Id: geqo_pool.c,v 1.8 1998/06/15 19:28:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -66,9 +66,7 @@ alloc_pool(int pool_size, int string_length)
/* all gene */
chromo = (Chromosome *) new_pool->data; /* vector of all chromos */
for (i = 0; i < pool_size; i++)
{
chromo[i].string = palloc((string_length + 1) * sizeof(Gene));
}
return (new_pool);
}

View File

@@ -6,7 +6,7 @@
* PX operator according to Syswerda
* (The Genetic Algorithms Handbook, L Davis, ed)
*
* $Id: geqo_px.c,v 1.4 1997/09/08 21:44:35 momjian Exp $
* $Id: geqo_px.c,v 1.5 1998/06/15 19:28:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -70,9 +70,7 @@ px(Gene *tour1, Gene *tour2, Gene *offspring, int num_gene, City *city_table)
/* initialize city table */
for (i = 1; i <= num_gene; i++)
{
city_table[i].used = 0;
}
/* choose random positions that will be inherited directly from parent */
num_positions = geqo_randint(2 * num_gene / 3, num_gene / 3);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/Attic/minspantree.c,v 1.4 1997/09/08 21:44:42 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/Attic/minspantree.c,v 1.5 1998/06/15 19:28:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -88,9 +88,7 @@ minspantree(Query *root, List *join_rels, Rel *garel)
id2 = (int) lsecond(joinrel->relids);
if (id1 > id2)
{
tmprel_array[id2][id1] = *(Rel *) joinrel;
}
else
{
tmprel_array[id1][id2] = *(Rel *) joinrel; /* ever reached? */
@@ -121,25 +119,17 @@ minspantree(Query *root, List *join_rels, Rel *garel)
{
garel[1] = tmprel_array[1][3];
if (rel12->cheapestpath->path_cost > rel23->cheapestpath->path_cost)
{
garel[2] = tmprel_array[2][3];
}
else
{
garel[2] = tmprel_array[1][2];
}
}
else
{
garel[1] = tmprel_array[1][2];
if (rel13->cheapestpath->path_cost > rel23->cheapestpath->path_cost)
{
garel[2] = tmprel_array[2][3];
}
else
{
garel[2] = tmprel_array[1][3];
}
}
}
@@ -169,13 +159,9 @@ minspantree(Query *root, List *join_rels, Rel *garel)
if (connectto[tempn] != 0)
{
if (n > tempn)
{
joinrel = (Rel *) &tmprel_array[tempn][n];
}
else
{
joinrel = (Rel *) &tmprel_array[n][tempn];
}
dist = joinrel->cheapestpath->path_cost;
if (dist < disttoconnect[tempn])
@@ -192,13 +178,9 @@ minspantree(Query *root, List *join_rels, Rel *garel)
}
n = nextn;
if (n > connectto[n])
{
garel[i] = tmprel_array[connectto[n]][n];
}
else
{
garel[i] = tmprel_array[n][connectto[n]];
}
i++;
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.15 1998/02/26 04:32:27 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.16 1998/06/15 19:28:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -259,9 +259,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
root->join_relation_list_ = outer_rels;
}
else
{
root->join_relation_list_ = new_rels;
}
if (!BushyPlanFlag)
outer_rels = new_rels;
}
@@ -407,16 +405,12 @@ debug_print_rel(Query *root, Rel *rel)
printf("(");
foreach(l, rel->relids)
{
printf("%d ", lfirsti(l));
}
printf("): size=%d width=%d\n", rel->size, rel->width);
printf("\tpath list:\n");
foreach(l, rel->pathlist)
{
print_path(root, lfirst(l), 1);
}
printf("\tcheapest path:\n");
print_path(root, rel->cheapestpath, 1);
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.7 1998/04/27 04:05:49 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.8 1998/06/15 19:28:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -54,9 +54,7 @@ set_clause_selectivities(List *clauseinfo_list, Cost new_selectivity)
clausenode = (CInfo *) lfirst(temp);
cost_clause = clausenode->selectivity;
if (FLOAT_IS_ZERO(cost_clause) || new_selectivity < cost_clause)
{
clausenode->selectivity = new_selectivity;
}
}
}
@@ -225,18 +223,14 @@ compute_selec(Query *root, List *clauses, List *or_selectivities)
List *clause = lfirst(clauses);
if (clauses == NULL)
{
s1 = 1.0;
}
else if (IsA(clause, Param))
{
/* XXX How're we handling this before?? -ay */
s1 = 1.0;
}
else if (IsA(clause, Const))
{
s1 = ((bool) ((Const *) clause)->constvalue) ? 1.0 : 0.0;
}
else if (IsA(clause, Var))
{
Oid relid = getrelid(((Var *) clause)->varno,
@@ -369,9 +363,7 @@ compute_selec(Query *root, List *clauses, List *or_selectivities)
*/
if (length(clauses) < 2)
{
return (s1);
}
else
{
/* Compute selectivity of the 'or'ed subclauses. */

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.20 1998/01/13 04:04:06 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.21 1998/06/15 19:28:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -368,13 +368,9 @@ compute_rel_size(Rel *rel)
temp = rel->tuples * product_selec(rel->clauseinfo);
Assert(temp >= 0);
if (temp >= (MAXINT - 1))
{
temp1 = MAXINT;
}
else
{
temp1 = ceil((double) temp);
}
Assert(temp1 >= 0);
Assert(temp1 <= MAXINT);
return (temp1);
@@ -449,9 +445,7 @@ compute_joinrel_size(JoinPath *joinpath)
temp = temp * product_selec(joinpath->pathclauseinfo);
if (temp >= (MAXINT - 1))
{
temp1 = MAXINT;
}
else
{

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.15 1998/04/27 04:05:53 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.16 1998/06/15 19:28:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -662,9 +662,7 @@ match_clause_to_indexkey(Rel *rel,
else if (leftop
&& match_index_to_operand(indexkey,
(Expr *) leftop, rel, index))
{
join_op = ((Oper *) ((Expr *) clause)->oper)->opno;
}
if (join_op && op_class(join_op, xclass, index->relam) &&
join_clause_p((Node *) clause))
@@ -943,9 +941,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
!IsA(predicate->oper, Oper) ||
!IsA(pred_var, Var) ||
!IsA(pred_const, Const))
{
return false;
}
/*
* The implication can't be determined unless the predicate and the
@@ -1161,9 +1157,7 @@ extract_restrict_clauses(List *clausegroup)
CInfo *cinfo = lfirst(l);
if (!join_clause_p((Node *) cinfo->clause))
{
restrict_cls = lappend(restrict_cls, cinfo);
}
}
return restrict_cls;
}
@@ -1293,9 +1287,7 @@ create_index_paths(Query *root,
if (!(join_clause_p((Node *) clauseinfo->clause) &&
equal_path_merge_ordering(index->ordering,
clauseinfo->mergesortorder)))
{
temp = false;
}
}
if (!join || temp)

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.5 1997/09/08 21:44:59 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.6 1998/06/15 19:28:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -180,9 +180,7 @@ find_all_join_paths(Query *root, List *joinrels)
* wierd behavior.
*/
if (IsA_JoinPath(path))
{
((Path *) lfirst(path))->outerjoincost = (Cost) 0;
}
/*
* do it iff it is a join path, which is not always true, esp
@@ -354,9 +352,7 @@ match_unsorted_outer(Rel *joinrel,
}
if (xmergeinfo)
{
clauses = xmergeinfo->jmethod.clauses;
}
if (clauses)
{
@@ -374,19 +370,13 @@ match_unsorted_outer(Rel *joinrel,
joinrel->targetlist, clauses);
}
else
{
merge_pathkeys = outerpath->keys;
}
if (best_innerjoin &&
path_is_cheaper(best_innerjoin, cheapest_inner))
{
nestinnerpath = best_innerjoin;
}
else
{
nestinnerpath = cheapest_inner;
}
paths = lcons(create_nestloop_path(joinrel,
outerrel,
@@ -429,13 +419,9 @@ match_unsorted_outer(Rel *joinrel,
* wouldn't otherwise be considered.
*/
if (path_is_cheaper_than_sort)
{
mergeinnerpath->outerjoincost = outerpath->path_cost;
}
else
{
mergeinnerpath = cheapest_inner;
}
temp_node =
lcons(create_mergesort_path(joinrel,
@@ -453,9 +439,7 @@ match_unsorted_outer(Rel *joinrel,
paths);
}
else
{
temp_node = paths;
}
jp_list = nconc(jp_list, temp_node);
}
return (jp_list);
@@ -518,9 +502,7 @@ match_unsorted_inner(Rel *joinrel,
}
if (xmergeinfo)
{
clauses = ((JoinMethod *) xmergeinfo)->clauses;
}
if (clauses)
{

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.9 1998/03/30 16:46:45 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.10 1998/06/15 19:28:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -138,9 +138,7 @@ find_clause_joins(Query *root, Rel *outer_rel, List *joininfo_list)
joininfo);
}
else
{
rel = NULL;
}
if (rel != NULL)
join_list = lappend(join_list, rel);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.5 1998/02/26 04:32:40 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.6 1998/06/15 19:28:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -106,16 +106,12 @@ match_pathkeys_joinkeys(List *pathkeys,
joinkeys = LispRemove(xjoinkey, joinkeys);
}
else
{
return (NIL);
}
}
if (matched_joinkeys == NULL ||
length(matched_joinkeys) != length(pathkeys))
{
return NIL;
}
*matchedJoinClausesPtr = nreverse(matched_joinclauses);
return (nreverse(matched_joinkeys));
@@ -239,9 +235,7 @@ match_paths_joinkeys(List *joinkeys,
matched_path = path;
}
else
{
matched_path = path;
}
}
}
return matched_path;
@@ -341,9 +335,7 @@ new_join_pathkeys(List *outer_pathkeys,
x = new_join_pathkey(outer_pathkey, NIL,
join_rel_tlist, joinclauses);
if (x != NIL)
{
t_list = lappend(t_list, x);
}
}
return (t_list);
}
@@ -396,9 +388,7 @@ new_join_pathkey(List *subkeys,
matched_subkeys);
}
else
{
newly_considered_subkeys = matched_subkeys;
}
considered_subkeys =
append(considered_subkeys, newly_considered_subkeys);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.5 1998/02/26 04:32:41 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.6 1998/06/15 19:28:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -128,9 +128,7 @@ create_or_index_paths(Query *root,
create_or_index_paths(root, rel, lnext(clauses)));
}
else
{
t_list = create_or_index_paths(root, rel, lnext(clauses));
}
}
}
@@ -237,21 +235,13 @@ best_or_subclause_index(Query *root,
Cost subclause_selec;
if (constant_on_right)
{
value = ((Const *) get_rightop(subclause))->constvalue;
}
else
{
value = NameGetDatum("");
}
if (constant_on_right)
{
flag = (_SELEC_IS_CONSTANT_ || _SELEC_CONSTANT_RIGHT_);
}
else
{
flag = _SELEC_CONSTANT_RIGHT_;
}
index_selectivity(lfirsti(index->relids),
index->classlist,
lconsi(opno, NIL),

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.10 1998/03/30 16:46:55 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.11 1998/06/15 19:28:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -444,9 +444,7 @@ xfunc_form_groups(Query *queryInfo, Stream root, Stream bottom)
primjoin, NIL));
}
else
{
set_groupsel(temp, 1.0);
}
}
else
/* a restriction, or 2-ary join pred */

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.13 1998/04/02 07:27:15 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.14 1998/06/15 19:28:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -75,9 +75,7 @@ prune_joinrel(Rel *rel, List *other_rels)
other_rel->pathlist);
}
else
{
result = nconc(result, lcons(other_rel, NIL));
}
}
return (result);
}
@@ -110,15 +108,11 @@ prune_rel_paths(List *rel_list)
path = (Path *) lfirst(y);
if (!path->p_ordering.ord.sortop)
{
break;
}
}
cheapest = (JoinPath *) prune_rel_path(rel, path);
if (IsA_JoinPath(cheapest))
{
rel->size = compute_joinrel_size(cheapest);
}
else
elog(ERROR, "non JoinPath called");
}
@@ -149,9 +143,7 @@ prune_rel_path(Rel *rel, Path *unorderedpath)
rel->pathlist = lremove(unorderedpath, rel->pathlist);
}
else
{
rel->unorderedpath = (Path *) unorderedpath;
}
return (cheapest);
}

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.14 1998/06/15 18:39:26 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.15 1998/06/15 19:28:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -335,13 +335,9 @@ xfunc_pullup(Query *queryInfo,
(LispValue) get_locclauseinfo(parentpath)));
/* put new childpath into the path tree */
if (whichchild == INNER)
{
set_innerjoinpath(parentpath, (pathPtr) newkid);
}
else
{
set_outerjoinpath(parentpath, (pathPtr) newkid);
}
/*
* * recompute parentpath cost from scratch -- the cost * of the join
@@ -497,9 +493,7 @@ xfunc_func_expense(LispValue node, LispValue args)
elog(ERROR, "Oper's function is undefined");
}
else
{
funcid = get_funcid((Func) node);
}
/* look up tuple in cache */
tupl = SearchSysCacheTuple(PROOID, ObjectIdGetDatum(funcid), 0, 0, 0);
@@ -1188,9 +1182,7 @@ xfunc_fixvars(LispValue clause, /* clause being pulled up */
tmpclause = lnext(tmpclause))
xfunc_fixvars(lfirst(tmpclause), rel, varno);
else
{
elog(ERROR, "Clause node of undetermined type");
}
}
@@ -1411,9 +1403,7 @@ xfunc_LispRemove(LispValue foo, List bar)
for (temp = bar; !null(temp); temp = lnext(temp))
if (!equal((Node) (foo), (Node) (lfirst(temp))))
{
result = lappend(result, lfirst(temp));
}
else
sanity = true; /* found a matching item to remove! */
@@ -1444,9 +1434,7 @@ xfunc_copyrel(Rel from, Rel *to)
/* COPY_CHECKARGS() */
if (to == NULL)
{
return false;
}
/* COPY_CHECKNULL() */
if (from == NULL)
@@ -1458,9 +1446,7 @@ xfunc_copyrel(Rel from, Rel *to)
/* COPY_NEW(c) */
newnode = (Rel) (*alloc) (classSize(Rel));
if (newnode == NULL)
{
return false;
}
/* ----------------
* copy node superclass fields

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.27 1998/02/26 04:32:48 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.28 1998/06/15 19:28:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -678,9 +678,7 @@ fix_indxqual_references(Node *clause, Path *index_path)
while (indexkeys[pos] != 0)
{
if (varatt == indexkeys[pos])
{
break;
}
pos++;
}
}
@@ -689,14 +687,10 @@ fix_indxqual_references(Node *clause, Path *index_path)
return (newclause);
}
else
{
return (clause);
}
}
else if (IsA(clause, Const))
{
return (clause);
}
else if (IsA(clause, Param))
{
/* Function parameter used as index scan arg. DZ - 27-8-1996 */
@@ -749,9 +743,7 @@ fix_indxqual_references(Node *clause, Path *index_path)
make_clause(expr->opType, expr->oper, new_subclauses);
}
else
{
return (clause);
}
}
else
{
@@ -776,13 +768,9 @@ fix_indxqual_references(Node *clause, Path *index_path)
* (var const) ...) ?
*/
if (new_subclauses)
{
return (Node *) new_subclauses;
}
else
{
return (clause);
}
}
}
@@ -1179,9 +1167,7 @@ make_unique(List *tlist, Plan *lefttree, char *uniqueAttr)
if (strcmp(uniqueAttr, "*") == 0)
node->uniqueAttr = NULL;
else
{
node->uniqueAttr = pstrdup(uniqueAttr);
}
return (node);
}
@@ -1209,9 +1195,7 @@ generate_fjoin(List *tlist)
fjoinList = lappend(fjoinList, tlistElem);
}
else
{
newTlist = lappend(newTlist, tlistElem);
}
}
/*

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.11 1998/03/16 05:49:32 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.12 1998/06/15 19:28:43 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -150,9 +150,7 @@ initialize_base_rels_jinfo(Query *root, List *clauses)
List *clause;
foreach(clause, clauses)
{
add_clause_to_rels(root, lfirst(clause));
}
return;
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.21 1998/03/31 23:30:49 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.22 1998/06/15 19:28:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -162,9 +162,7 @@ query_planner(Query *root,
(Plan *) scan));
}
else
{
return ((Plan *) scan);
}
}
break;
@@ -308,9 +306,7 @@ subplanner(Query *root,
* it.
*/
if (final_relation)
{
return (create_plan((Path *) final_relation->cheapestpath));
}
else
{
elog(NOTICE, "final relation is nil");
@@ -423,9 +419,7 @@ make_groupPlan(List **tlist,
}
if (length(glc) != 0)
{
elog(ERROR, "group attribute disappeared from target list");
}
/*
* If non-GroupBy entries were removed from TL - we are to add Vars

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.21 1998/04/15 15:29:44 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.22 1998/06/15 19:28:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -73,34 +73,22 @@ set_tlist_references(Plan *plan)
return;
if (IsA_Join(plan))
{
set_join_tlist_references((Join *) plan);
}
else if (IsA(plan, SeqScan) &&plan->lefttree &&
IsA_Temp(plan->lefttree))
{
set_tempscan_tlist_references((SeqScan *) plan);
}
else if (IsA(plan, Sort))
{
set_temp_tlist_references((Temp *) plan);
}
else if (IsA(plan, Result))
{
set_result_tlist_references((Result *) plan);
}
else if (IsA(plan, Hash))
{
set_tlist_references(plan->lefttree);
}
else if (IsA(plan, Choose))
{
List *x;
foreach(x, ((Choose *) plan)->chooseplanlist)
{
set_tlist_references((Plan *) lfirst(x));
}
}
}
@@ -200,9 +188,7 @@ set_temp_tlist_references(Temp *temp)
(source)->targetlist);
}
else
{
elog(ERROR, "calling set_temp_tlist_references with empty lefttree");
}
}
/*
@@ -326,9 +312,7 @@ replace_clause_joinvar_refs(Expr *clause,
return (NIL);
}
else if (single_node((Node *) clause))
{
return ((List *) clause);
}
else if (and_clause((Node *) clause))
{
List *andclause =
@@ -609,9 +593,7 @@ replace_result_clause(Node *clause,
((Var *) clause)->varattno = subplanVar->resdom->resno;
}
else if (IsA(clause, Aggreg))
{
replace_result_clause(((Aggreg *) clause)->target, subplanTargetList);
}
else if (is_funcclause(clause))
{
List *subExpr;
@@ -622,9 +604,7 @@ replace_result_clause(Node *clause,
*/
subExpr = ((Expr *) clause)->args;
foreach(t, subExpr)
{
replace_result_clause(lfirst(t), subplanTargetList);
}
}
else if (IsA(clause, ArrayRef))
{
@@ -635,13 +615,9 @@ replace_result_clause(Node *clause,
* expression and its index expression...
*/
foreach(t, aref->refupperindexpr)
{
replace_result_clause(lfirst(t), subplanTargetList);
}
foreach(t, aref->reflowerindexpr)
{
replace_result_clause(lfirst(t), subplanTargetList);
}
replace_result_clause(aref->refexpr,
subplanTargetList);
replace_result_clause(aref->refassgnexpr,
@@ -687,18 +663,14 @@ OperandIsInner(Node *opnd, int inner_relid)
*/
if (IsA(opnd, Var) &&
(inner_relid == ((Var *) opnd)->varno))
{
return true;
}
if (is_funcclause(opnd))
{
List *firstArg = lfirst(((Expr *) opnd)->args);
if (IsA(firstArg, Var) &&
(inner_relid == ((Var *) firstArg)->varno))
{
return true;
}
}
return false;
}
@@ -864,9 +836,7 @@ del_agg_clause(Node *clause)
List *t;
if (IsA(clause, Var))
{
return clause;
}
else if (is_funcclause(clause))
{
@@ -875,9 +845,7 @@ del_agg_clause(Node *clause)
* arguments...
*/
foreach(t, ((Expr *) clause)->args)
{
lfirst(t) = del_agg_clause(lfirst(t));
}
}
else if (IsA(clause, Aggreg))
{
@@ -895,13 +863,9 @@ del_agg_clause(Node *clause)
* expression and its index expression...
*/
foreach(t, aref->refupperindexpr)
{
lfirst(t) = del_agg_clause(lfirst(t));
}
foreach(t, aref->reflowerindexpr)
{
lfirst(t) = del_agg_clause(lfirst(t));
}
aref->refexpr = del_agg_clause(aref->refexpr);
aref->refassgnexpr = del_agg_clause(aref->refassgnexpr);
}
@@ -921,9 +885,7 @@ del_agg_clause(Node *clause)
right = del_agg_clause(right);
}
else if (IsA(clause, Param) ||IsA(clause, Const))
{
return clause;
}
else
{

View File

@@ -92,9 +92,7 @@ _replace_var(Var *var)
}
if ((i = lfirsti(vpe)) < 0) /* parameter is not assigned */
{
i = _new_param(var, PlannerQueryLevel - var->varlevelsup);
}
retval = makeNode(Param);
retval->paramkind = PARAM_EXEC;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepqual.c,v 1.8 1998/02/26 04:32:57 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepqual.c,v 1.9 1998/06/15 19:28:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -129,13 +129,9 @@ pull_args(Expr *qual)
return (make_orclause(pull_ors(t_list)));
}
else if (not_clause((Node *) qual))
{
return (make_notclause(pull_args(get_notclausearg(qual))));
}
else
{
return (qual);
}
}
/*
@@ -159,9 +155,7 @@ pull_ors(List *orlist)
copyObject((Node *) lnext(orlist)))));
}
else
{
return (lcons(lfirst(orlist), pull_ors(lnext(orlist))));
}
}
/*
@@ -185,9 +179,7 @@ pull_ands(List *andlist)
copyObject((Node *) lnext(andlist)))));
}
else
{
return (lcons(lfirst(andlist), pull_ands(lnext(andlist))));
}
}
/*
@@ -219,9 +211,7 @@ find_nots(Expr *qual)
List *t_list = NIL;
foreach(temp, qual->args)
{
t_list = lappend(t_list, find_nots(lfirst(temp)));
}
return (make_andclause(t_list));
}
@@ -231,9 +221,7 @@ find_nots(Expr *qual)
List *t_list = NIL;
foreach(temp, qual->args)
{
t_list = lappend(t_list, find_nots(lfirst(temp)));
}
return (make_orclause(t_list));
}
else if (not_clause((Node *) qual))
@@ -277,9 +265,7 @@ push_nots(Expr *qual)
(make_opclause(op, get_leftop(qual), get_rightop(qual)));
}
else
{
return (make_notclause(qual));
}
}
else if (and_clause((Node *) qual))
{
@@ -293,9 +279,7 @@ push_nots(Expr *qual)
List *t_list = NIL;
foreach(temp, qual->args)
{
t_list = lappend(t_list, push_nots(lfirst(temp)));
}
return (make_orclause(t_list));
}
else if (or_clause((Node *) qual))
@@ -304,9 +288,7 @@ push_nots(Expr *qual)
List *t_list = NIL;
foreach(temp, qual->args)
{
t_list = lappend(t_list, push_nots(lfirst(temp)));
}
return (make_andclause(t_list));
}
else if (not_clause((Node *) qual))
@@ -357,9 +339,7 @@ normalize(Expr *qual)
List *t_list = NIL;
foreach(temp, qual->args)
{
t_list = lappend(t_list, normalize(lfirst(temp)));
}
return (make_andclause(t_list));
}
else if (or_clause((Node *) qual))
@@ -370,9 +350,7 @@ normalize(Expr *qual)
bool has_andclause = FALSE;
foreach(temp, qual->args)
{
orlist = lappend(orlist, normalize(lfirst(temp)));
}
foreach(temp, orlist)
{
if (and_clause(lfirst(temp)))
@@ -427,9 +405,7 @@ or_normalize(List *orlist)
lnext(new_orlist))));
}
else
{
return (orlist);
}
}
/*
@@ -562,13 +538,9 @@ remove_ands(Expr *qual)
return ((List *) make_orclause((List *) t_list));
}
else if (not_clause((Node *) qual))
{
return ((List *) make_notclause((Expr *) remove_ands((Expr *) get_notclausearg(qual))));
}
else
{
return ((List *) qual);
}
}
/*****************************************************************************

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.10 1998/02/26 04:33:02 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.11 1998/06/15 19:28:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -67,9 +67,7 @@ preprocess_targetlist(List *tlist,
List *temp = NIL;
if (result_relation >= 1 && command_type != CMD_SELECT)
{
relid = getrelid(result_relation, range_table);
}
/*
* for heap_formtuple to work, the targetlist must match the exact
@@ -171,9 +169,7 @@ expand_targetlist(List *tlist,
return (replace_matching_resname(ntlist, tlist));
}
else
{
return (tlist);
}
}
@@ -210,9 +206,7 @@ replace_matching_resname(List *new_tlist, List *old_tlist)
t_list = lappend(t_list, matching_old_tl);
}
else
{
t_list = lappend(t_list, new_tle);
}
}
/*

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.23 1998/03/31 23:30:59 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.24 1998/06/15 19:28:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -333,9 +333,7 @@ find_all_inheritors(List *unexamined_relids,
new_examined_relids);
if (new_unexamined_relids == NULL)
{
return (new_examined_relids);
}
else
{
return (find_all_inheritors(new_unexamined_relids,

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.16 1998/02/26 04:33:11 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.17 1998/06/15 19:28:47 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -332,13 +332,9 @@ pull_constant_clauses(List *quals, List **constantQual)
foreach(q, quals)
{
if (!contain_var_clause(lfirst(q)))
{
constqual = lcons(lfirst(q), constqual);
}
else
{
restqual = lcons(lfirst(q), restqual);
}
}
freeList(quals);
*constantQual = constqual;
@@ -371,9 +367,7 @@ clause_relids_vars(Node *clause, List **relids, List **vars)
List *vi;
if (!intMember(var->varno, varno_list))
{
varno_list = lappendi(varno_list, var->varno);
}
foreach(vi, var_list)
{
Var *in_list = (Var *) lfirst(vi);
@@ -410,9 +404,7 @@ NumRelids(Node *clause)
Var *var = (Var *) lfirst(i);
if (!intMember(var->varno, var_list))
{
var_list = lconsi(var->varno, var_list);
}
}
return (length(var_list));
@@ -497,14 +489,10 @@ qual_clause_p(Node *clause)
/* How about Param-s ? - vadim 02/03/98 */
if (IsA(get_leftop((Expr *) clause), Var) &&
IsA(get_rightop((Expr *) clause), Const))
{
return (true);
}
else if (IsA(get_rightop((Expr *) clause), Var) &&
IsA(get_leftop((Expr *) clause), Const))
{
return (true);
}
return (false);
}
@@ -519,17 +507,11 @@ void
fix_opid(Node *clause)
{
if (clause == NULL || single_node(clause))
{
;
}
else if (or_clause(clause) || and_clause(clause))
{
fix_opids(((Expr *) clause)->args);
}
else if (is_funcclause(clause))
{
fix_opids(((Expr *) clause)->args);
}
else if (IsA(clause, ArrayRef))
{
ArrayRef *aref = (ArrayRef *) clause;
@@ -540,9 +522,7 @@ fix_opid(Node *clause)
fix_opid(aref->refassgnexpr);
}
else if (not_clause(clause))
{
fix_opid((Node *) get_notclausearg((Expr *) clause));
}
else if (is_opclause(clause))
{
replace_opid((Oper *) ((Expr *) clause)->oper);
@@ -550,9 +530,7 @@ fix_opid(Node *clause)
fix_opid((Node *) get_rightop((Expr *) clause));
}
else if (agg_clause(clause))
{
fix_opid(((Aggreg *) clause)->target);
}
else if (is_subplan(clause) &&
((SubPlan *) ((Expr *) clause)->oper)->sublink->subLinkType != EXISTS_SUBLINK)
{

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.6 1998/02/26 04:33:13 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.7 1998/06/15 19:28:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,13 +36,9 @@ List *
find_relation_indices(Query *root, Rel *rel)
{
if (rel->indexed)
{
return (find_secondary_index(root, lfirsti(rel->relids)));
}
else
{
return (NIL);
}
}
/*

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.6 1998/02/26 04:33:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.7 1998/06/15 19:28:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -103,13 +103,9 @@ other_join_clause_var(Var *var, Expr *clause)
r = (Var *) get_rightop(clause);
if (var_equal(var, l))
{
retval = r;
}
else if (var_equal(var, r))
{
retval = l;
}
}
return (retval);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.7 1998/02/26 04:33:20 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.8 1998/06/15 19:28:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -77,9 +77,7 @@ set_cheapest(Rel *parent_rel, List *pathlist)
Path *path = (Path *) lfirst(p);
if (path_is_cheaper(path, cheapest_so_far))
{
cheapest_so_far = path;
}
}
parent_rel->cheapestpath = cheapest_so_far;
@@ -129,9 +127,7 @@ add_pathlist(Rel *parent_rel, List *unique_paths, List *new_paths)
{ /* (IsA(old_path,Path)) { */
new_path->parent = parent_rel;
if (!parent_rel->pruneable)
{
unique_paths = lcons(new_path, unique_paths);
}
else
unique_paths = lcons(new_path,
LispRemove(old_path, unique_paths));
@@ -180,16 +176,12 @@ better_path(Path *new_path, List *unique_paths, bool *noOther)
}
if (old_path == NULL)
{
*noOther = true;
}
else
{
*noOther = false;
if (path_is_cheaper(new_path, old_path))
{
retval = old_path;
}
}
return (retval);
@@ -299,14 +291,10 @@ create_index_path(Query *root,
* if no index keys were found, we can't order the path).
*/
if (pathnode->path.keys == NULL)
{
pathnode->path.p_ordering.ord.sortop = NULL;
}
}
else
{
pathnode->path.keys = NULL;
}
if (is_join_scan || restriction_clauses == NULL)
{
@@ -468,9 +456,7 @@ create_nestloop_path(Rel *joinrel,
/* add in expensive function costs -- JMH 7/7/92 */
#if 0
if (XfuncMode != XFUNC_OFF)
{
pathnode->path_cost += xfunc_get_path_cost((Path *) pathnode);
}
#endif
return (pathnode);
}

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.16 1998/02/26 04:33:21 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.17 1998/06/15 19:28:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -282,27 +282,19 @@ index_selectivity(Oid indid,
i = 0;
foreach(xopno, opnos)
{
opno_array[i++] = lfirsti(xopno);
}
i = 0;
foreach(xattno, attnos)
{
attno_array[i++] = lfirsti(xattno);
}
i = 0;
foreach(value, values)
{
value_array[i++] = (char *) lfirst(value);
}
i = 0;
foreach(flag, flags)
{
flag_array[i++] = lfirsti(flag);
}
IndexSelectivity(indid,
relid,

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.12 1998/02/26 04:33:22 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.13 1998/06/15 19:28:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -385,9 +385,7 @@ flatten_tlist(List *tlist)
temp_entry = lfirst(temp);
vars = pull_var_clause((Node *) get_expr(temp_entry));
if (vars != NULL)
{
tlist_vars = nconc(tlist_vars, vars);
}
}
foreach(temp, tlist_vars)

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.11 1998/02/26 04:33:22 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.12 1998/06/15 19:28:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -48,9 +48,7 @@ pull_varnos(Node *me)
{
case T_List:
foreach(i, (List *) me)
{
result = nconc(result, pull_varnos(lfirst(i)));
}
break;
case T_ArrayRef:
foreach(i, ((ArrayRef *) me)->refupperindexpr)
@@ -182,9 +180,7 @@ pull_var_clause(Node *clause)
pull_var_clause(lfirst(((Expr *) lfirst(temp))->args)));
}
else if (IsA(clause, Aggreg))
{
retval = pull_var_clause(((Aggreg *) clause)->target);
}
else if (IsA(clause, ArrayRef))
{
List *temp;