1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

pgindent run over code.

This commit is contained in:
Bruce Momjian
1999-05-25 16:15:34 +00:00
parent 4b04b01aaa
commit 07842084fe
413 changed files with 11723 additions and 10769 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.33 1999/05/10 00:45:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.34 1999/05/25 16:09:50 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -84,7 +84,7 @@ bool
is_opclause(Node *clause)
{
return (clause != NULL &&
nodeTag(clause) == T_Expr && ((Expr *) clause)->opType == OP_EXPR);
nodeTag(clause) == T_Expr && ((Expr *) clause)->opType == OP_EXPR);
}
/*
@@ -163,7 +163,7 @@ bool
is_funcclause(Node *clause)
{
return (clause != NULL &&
nodeTag(clause) == T_Expr && ((Expr *) clause)->opType == FUNC_EXPR);
nodeTag(clause) == T_Expr && ((Expr *) clause)->opType == FUNC_EXPR);
}
/*
@@ -320,7 +320,7 @@ bool
case_clause(Node *clause)
{
return (clause != NULL &&
nodeTag(clause) == T_CaseExpr);
nodeTag(clause) == T_CaseExpr);
}
/*****************************************************************************
@@ -369,7 +369,7 @@ pull_constant_clauses(List *quals, List **constantQual)
*
*/
void
clause_get_relids_vars(Node *clause, Relids *relids, List **vars)
clause_get_relids_vars(Node *clause, Relids * relids, List **vars)
{
List *clvars = pull_var_clause(clause);
List *var_list = NIL;
@@ -515,9 +515,9 @@ qual_clause_p(Node *clause)
return false; /* unary opclauses need not apply */
/* How about Param-s ? - vadim 02/03/98 */
if (IsA(leftop, Var) && IsA(rightop, Const))
if (IsA(leftop, Var) &&IsA(rightop, Const))
return true;
if (IsA(rightop, Var) && IsA(leftop, Const))
if (IsA(rightop, Var) &&IsA(leftop, Const))
return true;
return false;
}
@@ -646,14 +646,14 @@ get_relattval(Node *clause,
if (!right)
goto default_results;
if (IsA(left, Var) && IsA(right, Const))
if (IsA(left, Var) &&IsA(right, Const))
{
*relid = left->varno;
*attno = left->varattno;
*constval = ((Const *) right)->constvalue;
*flag = (_SELEC_CONSTANT_RIGHT_ | _SELEC_IS_CONSTANT_);
}
else if (IsA(left, Var) && IsA(right, Param))
else if (IsA(left, Var) &&IsA(right, Param))
{
*relid = left->varno;
*attno = left->varattno;
@@ -669,7 +669,7 @@ get_relattval(Node *clause,
*constval = ((Const *) right)->constvalue;
*flag = (_SELEC_CONSTANT_RIGHT_ | _SELEC_IS_CONSTANT_);
}
else if (IsA(right, Var) && IsA(left, Const))
else if (IsA(right, Var) &&IsA(left, Const))
{
*relid = right->varno;
*attno = right->varattno;
@@ -723,16 +723,16 @@ get_rels_atts(Node *clause,
{
if (is_opclause(clause))
{
Var *left = get_leftop((Expr *) clause);
Var *right = get_rightop((Expr *) clause);
Var *left = get_leftop((Expr *) clause);
Var *right = get_rightop((Expr *) clause);
if (left && right)
{
bool var_left = IsA(left, Var);
bool var_right = IsA(right, Var);
bool varexpr_left = (bool) ((IsA(left, Func) || IsA(left, Oper)) &&
contain_var_clause((Node *) left));
bool varexpr_right = (bool) ((IsA(right, Func) || IsA(right, Oper)) &&
bool var_left = IsA(left, Var);
bool var_right = IsA(right, Var);
bool varexpr_left = (bool) ((IsA(left, Func) ||IsA(left, Oper)) &&
contain_var_clause((Node *) left));
bool varexpr_right = (bool) ((IsA(right, Func) ||IsA(right, Oper)) &&
contain_var_clause((Node *) right));
if (var_left && var_right)

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.14 1999/02/13 23:16:43 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.15 1999/05/25 16:09:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,7 +33,7 @@ static List *find_secondary_index(Query *root, Oid relid);
*
*/
List *
find_relation_indices(Query *root, RelOptInfo *rel)
find_relation_indices(Query *root, RelOptInfo * rel)
{
if (rel->indexed)
return find_secondary_index(root, lfirsti(rel->relids));

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.19 1999/02/22 05:26:26 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.20 1999/05/25 16:09:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,11 +38,11 @@
JoinInfo *
joininfo_member(List *join_relids, List *joininfo_list)
{
List *i;
List *i;
foreach(i, joininfo_list)
{
JoinInfo *joininfo = (JoinInfo *)lfirst(i);
JoinInfo *joininfo = (JoinInfo *) lfirst(i);
if (same(join_relids, joininfo->unjoined_relids))
return joininfo;
@@ -62,7 +62,7 @@ joininfo_member(List *join_relids, List *joininfo_list)
*
*/
JoinInfo *
find_joininfo_node(RelOptInfo *this_rel, Relids join_relids)
find_joininfo_node(RelOptInfo * this_rel, Relids join_relids)
{
JoinInfo *joininfo = joininfo_member(join_relids,
this_rel->joininfo);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.19 1999/02/20 18:01:02 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.20 1999/05/25 16:09:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -54,7 +54,7 @@ static bool equal_indexkey_var(int index_key, Var *var);
*
*/
bool
match_indexkey_operand(int indexkey, Var *operand, RelOptInfo *rel)
match_indexkey_operand(int indexkey, Var *operand, RelOptInfo * rel)
{
if (IsA(operand, Var) &&
(lfirsti(rel->relids) == operand->varno) &&
@@ -112,7 +112,7 @@ extract_join_key(JoinKey *jk, int outer_or_inner)
*
* See the top of optimizer/path/pathkeys.c for a description of pathkeys.
* Each pathkey is ordered by its join order, so they not pre-ordered to
* match. We must search them ourselves.
* match. We must search them ourselves.
*
* This gets called a lot, so it is optimized.
*/
@@ -128,31 +128,33 @@ pathkeys_match(List *keys1, List *keys2, int *better_key)
key1 != NIL && key2 != NIL;
key1 = lnext(key1), key2 = lnext(key2))
{
List *i;
List *i;
if (key1_subsetof_key2)
foreach(i, lfirst(key1))
{
Var *subkey = lfirst(i);
if (!member(subkey, lfirst(key2)))
{
Var *subkey = lfirst(i);
if (!member(subkey, lfirst(key2)))
{
key1_subsetof_key2 = false;
break;
}
key1_subsetof_key2 = false;
break;
}
}
if (key2_subsetof_key1)
foreach(i, lfirst(key2))
{
Var *subkey = lfirst(i);
if (!member(subkey, lfirst(key1)))
{
Var *subkey = lfirst(i);
if (!member(subkey, lfirst(key1)))
{
key2_subsetof_key1 = false;
break;
}
key2_subsetof_key1 = false;
break;
}
}
if (!key1_subsetof_key2 && !key2_subsetof_key1)
break; /* no need to continue comparisons. */
break; /* no need to continue comparisons. */
}
if (!key1_subsetof_key2 && !key2_subsetof_key1)

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/ordering.c,v 1.15 1999/02/13 23:16:46 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/ordering.c,v 1.16 1999/05/25 16:09:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,7 +19,7 @@
#include "optimizer/ordering.h"
static bool sortops_order_match(Oid *ordering1, Oid *ordering2,
int *better_sort);
int *better_sort);
/*
* equal_path_ordering
@@ -31,12 +31,12 @@ pathorder_match(PathOrder *path_ordering1,
PathOrder *path_ordering2,
int *better_sort)
{
*better_sort = 0;
if (path_ordering1 == path_ordering2)
return true;
if (!path_ordering2)
{
*better_sort = 1;
@@ -51,15 +51,13 @@ pathorder_match(PathOrder *path_ordering1,
if (path_ordering1->ordtype == MERGE_ORDER &&
path_ordering2->ordtype == MERGE_ORDER)
{
return equal(path_ordering1->ord.merge, path_ordering2->ord.merge);
}
else if (path_ordering1->ordtype == SORTOP_ORDER &&
path_ordering2->ordtype == SORTOP_ORDER)
{
return sortops_order_match(path_ordering1->ord.sortop,
path_ordering2->ord.sortop,
better_sort);
path_ordering2->ord.sortop,
better_sort);
}
else if (path_ordering1->ordtype == MERGE_ORDER &&
path_ordering2->ordtype == SORTOP_ORDER)
@@ -112,7 +110,7 @@ equal_path_merge_ordering(Oid *path_ordering,
*/
bool
equal_merge_ordering(MergeOrder *merge_ordering1,
MergeOrder *merge_ordering2)
MergeOrder *merge_ordering2)
{
return equal(merge_ordering1, merge_ordering2);
}
@@ -133,7 +131,7 @@ sortops_order_match(Oid *ordering1, Oid *ordering2, int *better_sort)
int i = 0;
*better_sort = 0;
if (ordering1 == ordering2)
return true;
@@ -142,13 +140,13 @@ sortops_order_match(Oid *ordering1, Oid *ordering2, int *better_sort)
*better_sort = 1;
return true;
}
if (!ordering1)
{
*better_sort = 2;
return true;
}
while (ordering1[i] != 0 && ordering2[i] != 0)
{
if (ordering1[i] != ordering2[i])
@@ -167,6 +165,6 @@ sortops_order_match(Oid *ordering1, Oid *ordering2, int *better_sort)
*better_sort = 2;
return true;
}
return ordering1[i] == 0 && ordering2[i] == 0;
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.40 1999/02/21 03:48:54 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.41 1999/05/25 16:09:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -62,7 +62,7 @@ path_is_cheaper(Path *path1, Path *path2)
*
*/
Path *
set_cheapest(RelOptInfo *parent_rel, List *pathlist)
set_cheapest(RelOptInfo * parent_rel, List *pathlist)
{
List *p;
Path *cheapest_so_far;
@@ -99,14 +99,14 @@ set_cheapest(RelOptInfo *parent_rel, List *pathlist)
*
*/
List *
add_pathlist(RelOptInfo *parent_rel, List *unique_paths, List *new_paths)
add_pathlist(RelOptInfo * parent_rel, List *unique_paths, List *new_paths)
{
List *p1;
foreach(p1, new_paths)
{
Path *new_path = (Path *) lfirst(p1);
Path *old_path;
Path *old_path;
bool is_new;
/* Is this new path already in unique_paths? */
@@ -174,7 +174,7 @@ better_path(Path *new_path, List *unique_paths, bool *is_new)
#ifdef OPTDUP_DEBUG
if (!pathkeys_match(new_path->pathkeys, path->pathkeys, &better_key) ||
better_key != 0)
better_key != 0)
{
printf("betterkey = %d\n", better_key);
printf("newpath\n");
@@ -182,13 +182,15 @@ better_path(Path *new_path, List *unique_paths, bool *is_new)
printf("oldpath\n");
pprint(path->pathkeys);
if (path->pathkeys && new_path->pathkeys &&
length(lfirst(path->pathkeys)) >= 2/* &&
length(lfirst(path->pathkeys)) <
length(lfirst(new_path->pathkeys))*/)
sleep(0); /* set breakpoint here */
length(lfirst(path->pathkeys)) >= 2 /* &&
* length(lfirst(path->pa
* thkeys)) <
* length(lfirst(new_path
->pathkeys)) */ )
sleep(0); /* set breakpoint here */
}
if (!pathorder_match(new_path->pathorder, path->pathorder,
&better_sort) ||
&better_sort) ||
better_sort != 0)
{
printf("neword\n");
@@ -199,25 +201,26 @@ better_path(Path *new_path, List *unique_paths, bool *is_new)
#endif
if (pathkeys_match(new_path->pathkeys, path->pathkeys,
&better_key) &&
&better_key) &&
pathorder_match(new_path->pathorder, path->pathorder,
&better_sort))
&better_sort))
{
/*
* Replace pathkeys that match exactly, {{1,2}}, {{1,2}}
* Replace pathkeys {{1,2}} with {{1,2,3}}} if the latter is not
* more expensive and replace unordered path with ordered
* path if it is not more expensive. Favor sorted keys
* over unsorted keys in the same way.
* Replace pathkeys {{1,2}} with {{1,2,3}}} if the latter is
* not more expensive and replace unordered path with ordered
* path if it is not more expensive. Favor sorted keys over
* unsorted keys in the same way.
*/
/* same keys, and new is cheaper, use it */
if ((better_key == 0 && better_sort == 0 &&
/* same keys, and new is cheaper, use it */
if ((better_key == 0 && better_sort == 0 &&
new_path->path_cost < path->path_cost) ||
/* new is better, and cheaper, use it */
/* new is better, and cheaper, use it */
(((better_key == 1 && better_sort != 2) ||
(better_key != 2 && better_sort == 1)) &&
new_path->path_cost <= path->path_cost))
new_path->path_cost <= path->path_cost))
{
#ifdef OPTDUP_DEBUG
printf("replace with new %p old %p better key %d better sort %d\n", &new_path, &path, better_key, better_sort);
@@ -230,14 +233,14 @@ better_path(Path *new_path, List *unique_paths, bool *is_new)
return path;
}
/* same keys, new is more expensive, stop */
/* same keys, new is more expensive, stop */
if ((better_key == 0 && better_sort == 0 &&
new_path->path_cost >= path->path_cost) ||
/* old is better, and less expensive, stop */
/* old is better, and less expensive, stop */
(((better_key == 2 && better_sort != 1) ||
(better_key != 1 && better_sort == 2)) &&
new_path->path_cost >= path->path_cost))
new_path->path_cost >= path->path_cost))
{
#ifdef OPTDUP_DEBUG
printf("skip new %p old %p better key %d better sort %d\n", &new_path, &path, better_key, better_sort);
@@ -253,11 +256,11 @@ better_path(Path *new_path, List *unique_paths, bool *is_new)
}
#ifdef OPTDUP_DEBUG
printf("add new %p old %p better key %d better sort %d\n", &new_path, &path, better_key, better_sort);
printf("new\n");
pprint(new_path);
printf("add new %p old %p better key %d better sort %d\n", &new_path, &path, better_key, better_sort);
printf("new\n");
pprint(new_path);
#endif
*is_new = true;
return NULL;
}
@@ -275,7 +278,7 @@ better_path(Path *new_path, List *unique_paths, bool *is_new)
*
*/
Path *
create_seqscan_path(RelOptInfo *rel)
create_seqscan_path(RelOptInfo * rel)
{
int relid = 0;
@@ -290,7 +293,7 @@ create_seqscan_path(RelOptInfo *rel)
pathnode->pathkeys = NIL;
/*
* copy restrictinfo list into path for expensive function processing
* copy restrictinfo list into path for expensive function processing
* JMH, 7/7/92
*/
pathnode->loc_restrictinfo = (List *) copyObject((Node *) rel->restrictinfo);
@@ -303,9 +306,7 @@ create_seqscan_path(RelOptInfo *rel)
/* add in expensive functions cost! -- JMH, 7/7/92 */
#ifdef NOT_USED
if (XfuncMode != XFUNC_OFF)
{
pathnode->path_cost += xfunc_get_path_cost(pathnode);
}
#endif
return pathnode;
}
@@ -325,8 +326,8 @@ create_seqscan_path(RelOptInfo *rel)
*/
IndexPath *
create_index_path(Query *root,
RelOptInfo *rel,
RelOptInfo *index,
RelOptInfo * rel,
RelOptInfo * index,
List *restriction_clauses,
bool is_join_scan)
{
@@ -343,11 +344,11 @@ create_index_path(Query *root,
pathnode->indexqual = NIL;
/*
* copy restrictinfo list into path for expensive function processing
* copy restrictinfo list into path for expensive function processing
* JMH, 7/7/92
*/
pathnode->path.loc_restrictinfo = set_difference((List *) copyObject((Node *) rel->restrictinfo),
(List *) restriction_clauses);
(List *) restriction_clauses);
/*
* The index must have an ordering for the path to have (ordering)
@@ -356,7 +357,7 @@ create_index_path(Query *root,
if (pathnode->path.pathorder->ord.sortop)
{
pathnode->path.pathkeys = collect_index_pathkeys(index->indexkeys,
rel->targetlist);
rel->targetlist);
/*
* Check that the keys haven't 'disappeared', since they may no
@@ -381,19 +382,19 @@ create_index_path(Query *root,
/* is the statement above really true? what about IndexScan as the
inner of a join? */
pathnode->path.path_cost = cost_index(lfirsti(index->relids),
index->pages,
1.0,
rel->pages,
rel->tuples,
index->pages,
index->tuples,
false);
index->pages,
1.0,
rel->pages,
rel->tuples,
index->pages,
index->tuples,
false);
#ifdef NOT_USED
/* add in expensive functions cost! -- JMH, 7/7/92 */
if (XfuncMode != XFUNC_OFF)
{
pathnode->path_cost = (pathnode->path_cost +
xfunc_get_path_cost((Path *) pathnode));
xfunc_get_path_cost((Path *) pathnode));
}
#endif
}
@@ -427,24 +428,22 @@ create_index_path(Query *root,
&npages,
&selec);
/* each clause gets an equal selectivity */
clausesel = pow(selec, 1.0 / (double) length(restriction_clauses));
clausesel = pow(selec, 1.0 / (double) length(restriction_clauses));
pathnode->indexqual = restriction_clauses;
pathnode->path.path_cost = cost_index(lfirsti(index->relids),
(int) npages,
selec,
rel->pages,
rel->tuples,
index->pages,
index->tuples,
false);
(int) npages,
selec,
rel->pages,
rel->tuples,
index->pages,
index->tuples,
false);
#ifdef NOT_USED
/* add in expensive functions cost! -- JMH, 7/7/92 */
if (XfuncMode != XFUNC_OFF)
{
pathnode->path_cost += xfunc_get_path_cost((Path *) pathnode);
}
#endif
/*
@@ -474,8 +473,8 @@ create_index_path(Query *root,
*
*/
NestPath *
create_nestloop_path(RelOptInfo *joinrel,
RelOptInfo *outer_rel,
create_nestloop_path(RelOptInfo * joinrel,
RelOptInfo * outer_rel,
Path *outer_path,
Path *inner_path,
List *pathkeys)
@@ -492,7 +491,7 @@ create_nestloop_path(RelOptInfo *joinrel,
pathnode->path.outerjoincost = (Cost) 0.0;
pathnode->path.loc_restrictinfo = NIL;
pathnode->path.pathorder = makeNode(PathOrder);
if (pathkeys)
{
pathnode->path.pathorder->ordtype = outer_path->pathorder->ordtype;
@@ -508,12 +507,12 @@ create_nestloop_path(RelOptInfo *joinrel,
}
pathnode->path.path_cost = cost_nestloop(outer_path->path_cost,
inner_path->path_cost,
outer_rel->size,
inner_path->parent->size,
page_size(outer_rel->size,
outer_rel->width),
IsA(inner_path, IndexPath));
inner_path->path_cost,
outer_rel->size,
inner_path->parent->size,
page_size(outer_rel->size,
outer_rel->width),
IsA(inner_path, IndexPath));
/* add in expensive function costs -- JMH 7/7/92 */
#ifdef NOT_USED
if (XfuncMode != XFUNC_OFF)
@@ -542,7 +541,7 @@ create_nestloop_path(RelOptInfo *joinrel,
*
*/
MergePath *
create_mergejoin_path(RelOptInfo *joinrel,
create_mergejoin_path(RelOptInfo * joinrel,
int outersize,
int innersize,
int outerwidth,
@@ -571,19 +570,17 @@ create_mergejoin_path(RelOptInfo *joinrel,
pathnode->outersortkeys = outersortkeys;
pathnode->innersortkeys = innersortkeys;
pathnode->jpath.path.path_cost = cost_mergejoin(outer_path->path_cost,
inner_path->path_cost,
outersortkeys,
innersortkeys,
outersize,
innersize,
outerwidth,
innerwidth);
inner_path->path_cost,
outersortkeys,
innersortkeys,
outersize,
innersize,
outerwidth,
innerwidth);
/* add in expensive function costs -- JMH 7/7/92 */
#ifdef NOT_USED
if (XfuncMode != XFUNC_OFF)
{
pathnode->path_cost += xfunc_get_path_cost((Path *) pathnode);
}
#endif
return pathnode;
}
@@ -607,7 +604,7 @@ create_mergejoin_path(RelOptInfo *joinrel,
*
*/
HashPath *
create_hashjoin_path(RelOptInfo *joinrel,
create_hashjoin_path(RelOptInfo * joinrel,
int outersize,
int innersize,
int outerwidth,
@@ -639,17 +636,15 @@ create_hashjoin_path(RelOptInfo *joinrel,
pathnode->outerhashkeys = outerkeys;
pathnode->innerhashkeys = innerkeys;
pathnode->jpath.path.path_cost = cost_hashjoin(outer_path->path_cost,
inner_path->path_cost,
outerkeys,
innerkeys,
outersize, innersize,
outerwidth, innerwidth);
inner_path->path_cost,
outerkeys,
innerkeys,
outersize, innersize,
outerwidth, innerwidth);
/* add in expensive function costs -- JMH 7/7/92 */
#ifdef NOT_USED
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.29 1999/05/10 00:45:25 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.30 1999/05/25 16:09:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -461,6 +461,7 @@ VersionGetParents(Oid verrelid)
heap_close(relation);
return list;
}
#endif
@@ -545,6 +546,7 @@ IndexSelectivity(Oid indexrelid,
select = 1.0;
for (n = 0; n < nIndexKeys; ++n)
{
/*
* Find the AM class for this key.
*
@@ -579,7 +581,7 @@ IndexSelectivity(Oid indexrelid,
amopTuple = SearchSysCacheTuple(AMOPOPID,
ObjectIdGetDatum(indclass),
ObjectIdGetDatum(operatorObjectIds[n]),
ObjectIdGetDatum(operatorObjectIds[n]),
ObjectIdGetDatum(relam),
0);
if (!HeapTupleIsValid(amopTuple))

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.15 1999/02/18 00:49:38 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.16 1999/05/25 16:10:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,7 +30,7 @@
RelOptInfo *
get_base_rel(Query *root, int relid)
{
Relids relids;
Relids relids;
RelOptInfo *rel;
relids = lconsi(relid, NIL);
@@ -63,6 +63,7 @@ get_base_rel(Query *root, int relid)
*/
if (relid < 0)
{
/*
* If the relation is a materialized relation, assume
* constants for sizes.
@@ -75,6 +76,7 @@ get_base_rel(Query *root, int relid)
bool hasindex;
int pages,
tuples;
/*
* Otherwise, retrieve relation characteristics from the
* system catalogs.

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/restrictinfo.c,v 1.2 1999/02/13 23:16:49 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/restrictinfo.c,v 1.3 1999/05/25 16:10:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,7 +27,7 @@
*
*/
bool
valid_or_clause(RestrictInfo *restrictinfo)
valid_or_clause(RestrictInfo * restrictinfo)
{
if (restrictinfo != NULL &&
!single_node((Node *) restrictinfo->clause) &&
@@ -117,7 +117,7 @@ get_relattvals(List *restrictinfo_list,
}
/*
* get_joinvars
* get_joinvars
* Given a list of join restrictinfo nodes to be used with the index
* of an inner join relation, return three lists consisting of:
* the attributes corresponding to the inner join relation
@@ -184,7 +184,7 @@ get_opnos(List *restrictinfo_list)
{
temp = (RestrictInfo *) lfirst(i);
result = lappendi(result,
(((Oper *) temp->clause->oper)->opno));
(((Oper *) temp->clause->oper)->opno));
}
return result;
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.31 1999/05/17 17:03:23 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.32 1999/05/25 16:10:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -93,7 +93,7 @@ matching_tlist_var(Var *var, List *targetlist)
* CREATES: new var_node iff no matching var_node exists in targetlist
*/
void
add_var_to_tlist(RelOptInfo *rel, Var *var)
add_var_to_tlist(RelOptInfo * rel, Var *var)
{
Expr *oldvar;
@@ -114,8 +114,8 @@ add_var_to_tlist(RelOptInfo *rel, Var *var)
var->varoattno);
rel->targetlist = lappend(tlist,
create_tl_element(newvar,
length(tlist) + 1));
create_tl_element(newvar,
length(tlist) + 1));
}
}
@@ -203,6 +203,7 @@ tlist_member(Var *var, List *tlist)
foreach(i, tlist)
{
TargetEntry *tle = (TargetEntry *) lfirst(i);
if (var_equal(var, get_expr(tle)))
return tle->resdom;
}
@@ -222,6 +223,7 @@ tlist_resdom(List *tlist, Resdom *resnode)
{
TargetEntry *tle = (TargetEntry *) lfirst(i);
Resdom *resdom = tle->resdom;
/* Since resnos are supposed to be unique */
if (resnode->resno == resdom->resno)
return resdom;
@@ -362,7 +364,7 @@ flatten_tlist(List *tlist)
TargetEntry *temp_entry = (TargetEntry *) lfirst(temp);
tlist_vars = nconc(tlist_vars,
pull_var_clause((Node *) get_expr(temp_entry)));
pull_var_clause((Node *) get_expr(temp_entry)));
}
foreach(temp, tlist_vars)
@@ -411,8 +413,8 @@ flatten_tlist_vars(List *full_tlist, List *flat_tlist)
TargetEntry *tle = lfirst(x);
result = lappend(result, makeTargetEntry(tle->resdom,
flatten_tlistentry((Node *) get_expr(tle),
flat_tlist)));
flatten_tlistentry((Node *) get_expr(tle),
flat_tlist)));
}
return result;
@@ -456,10 +458,11 @@ flatten_tlistentry(Node *tlistentry, List *flat_tlist)
}
else if (IsA(tlistentry, Expr))
{
/*
* Recursively scan the arguments of an expression.
* NOTE: this must come after is_subplan() case since
* subplan is a kind of Expr node.
* Recursively scan the arguments of an expression. NOTE: this
* must come after is_subplan() case since subplan is a kind of
* Expr node.
*/
foreach(temp, ((Expr *) tlistentry)->args)
lfirst(temp) = flatten_tlistentry(lfirst(temp), flat_tlist);
@@ -467,8 +470,10 @@ flatten_tlistentry(Node *tlistentry, List *flat_tlist)
}
else if (IsA(tlistentry, Aggref))
{
/* XXX shouldn't this be recursing into the agg's target?
* Seems to work though, so will leave it alone ... tgl 5/99
/*
* XXX shouldn't this be recursing into the agg's target? Seems to
* work though, so will leave it alone ... tgl 5/99
*/
return tlistentry;
}
@@ -481,7 +486,7 @@ flatten_tlistentry(Node *tlistentry, List *flat_tlist)
foreach(temp, aref->reflowerindexpr)
lfirst(temp) = flatten_tlistentry(lfirst(temp), flat_tlist);
aref->refexpr = flatten_tlistentry(aref->refexpr, flat_tlist);
aref->refassgnexpr = flatten_tlistentry(aref->refassgnexpr,flat_tlist);
aref->refassgnexpr = flatten_tlistentry(aref->refassgnexpr, flat_tlist);
return tlistentry;
}
@@ -491,7 +496,8 @@ flatten_tlistentry(Node *tlistentry, List *flat_tlist)
foreach(temp, cexpr->args)
{
CaseWhen *cwhen = (CaseWhen *) lfirst(temp);
CaseWhen *cwhen = (CaseWhen *) lfirst(temp);
cwhen->expr = flatten_tlistentry(cwhen->expr, flat_tlist);
cwhen->result = flatten_tlistentry(cwhen->result, flat_tlist);
}
@@ -521,18 +527,18 @@ get_expr(TargetEntry *tle)
Var *
get_groupclause_expr(GroupClause *groupClause, List *targetList)
{
List *l;
TargetEntry *tle;
List *l;
TargetEntry *tle;
foreach(l, targetList)
{
tle = (TargetEntry *)lfirst(l);
tle = (TargetEntry *) lfirst(l);
if (tle->resdom->resgroupref == groupClause->tleGroupref)
return get_expr(tle);
}
elog(ERROR,
"get_groupclause_expr: GROUP BY expression not found in targetlist");
elog(ERROR,
"get_groupclause_expr: GROUP BY expression not found in targetlist");
return NULL;
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.18 1999/05/03 00:38:44 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.19 1999/05/25 16:10:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -102,10 +102,11 @@ contain_var_clause(Node *clause)
}
else if (IsA(clause, Expr))
{
/*
* Recursively scan the arguments of an expression.
* NOTE: this must come after is_subplan() case since
* subplan is a kind of Expr node.
* Recursively scan the arguments of an expression. NOTE: this
* must come after is_subplan() case since subplan is a kind of
* Expr node.
*/
foreach(temp, ((Expr *) clause)->args)
{
@@ -139,6 +140,7 @@ contain_var_clause(Node *clause)
foreach(temp, ((CaseExpr *) clause)->args)
{
CaseWhen *when = (CaseWhen *) lfirst(temp);
if (contain_var_clause(when->expr))
return TRUE;
if (contain_var_clause(when->result))
@@ -188,10 +190,11 @@ pull_var_clause(Node *clause)
}
else if (IsA(clause, Expr))
{
/*
* Recursively scan the arguments of an expression.
* NOTE: this must come after is_subplan() case since
* subplan is a kind of Expr node.
* Recursively scan the arguments of an expression. NOTE: this
* must come after is_subplan() case since subplan is a kind of
* Expr node.
*/
foreach(temp, ((Expr *) clause)->args)
retval = nconc(retval, pull_var_clause(lfirst(temp)));
@@ -214,6 +217,7 @@ pull_var_clause(Node *clause)
foreach(temp, ((CaseExpr *) clause)->args)
{
CaseWhen *when = (CaseWhen *) lfirst(temp);
retval = nconc(retval, pull_var_clause(when->expr));
retval = nconc(retval, pull_var_clause(when->result));
}