mirror of
https://github.com/postgres/postgres.git
synced 2025-11-15 03:41:20 +03:00
Renaming cleanup, no pgindent yet.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.21 1998/08/10 04:49:36 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.22 1998/09/01 03:23:17 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -280,7 +280,7 @@ print_joinclauses(Query *root, List *clauses)
|
||||
|
||||
foreach(l, clauses)
|
||||
{
|
||||
CInfo *c = lfirst(l);
|
||||
ClauseInfo *c = lfirst(l);
|
||||
|
||||
print_expr((Node *) c->clause, root->rtable);
|
||||
if (lnext(l))
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.11 1998/08/09 04:17:37 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.12 1998/09/01 03:23:19 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -46,12 +46,12 @@ void
|
||||
set_clause_selectivities(List *clauseinfo_list, Cost new_selectivity)
|
||||
{
|
||||
List *temp;
|
||||
CInfo *clausenode;
|
||||
ClauseInfo *clausenode;
|
||||
Cost cost_clause;
|
||||
|
||||
foreach(temp, clauseinfo_list)
|
||||
{
|
||||
clausenode = (CInfo *) lfirst(temp);
|
||||
clausenode = (ClauseInfo *) lfirst(temp);
|
||||
cost_clause = clausenode->selectivity;
|
||||
if (FLOAT_IS_ZERO(cost_clause) || new_selectivity < cost_clause)
|
||||
clausenode->selectivity = new_selectivity;
|
||||
@@ -76,11 +76,11 @@ product_selec(List *clauseinfo_list)
|
||||
|
||||
foreach(xclausenode, clauseinfo_list)
|
||||
{
|
||||
temp = ((CInfo *) lfirst(xclausenode))->selectivity;
|
||||
temp = ((ClauseInfo *) lfirst(xclausenode))->selectivity;
|
||||
result = result * temp;
|
||||
}
|
||||
}
|
||||
return (result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -117,12 +117,12 @@ void
|
||||
set_rest_selec(Query *root, List *clauseinfo_list)
|
||||
{
|
||||
List *temp = NIL;
|
||||
CInfo *clausenode = (CInfo *) NULL;
|
||||
ClauseInfo *clausenode = (ClauseInfo *) NULL;
|
||||
Cost cost_clause;
|
||||
|
||||
foreach(temp, clauseinfo_list)
|
||||
{
|
||||
clausenode = (CInfo *) lfirst(temp);
|
||||
clausenode = (ClauseInfo *) lfirst(temp);
|
||||
cost_clause = clausenode->selectivity;
|
||||
|
||||
/*
|
||||
@@ -179,11 +179,11 @@ compute_clause_selec(Query *root, Node *clause, List *or_selectivities)
|
||||
* Both 'or' and 'and' clauses are evaluated as described in
|
||||
* (compute_selec).
|
||||
*/
|
||||
return (compute_selec(root, ((Expr *) clause)->args, or_selectivities));
|
||||
return compute_selec(root, ((Expr *) clause)->args, or_selectivities);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (compute_selec(root, lcons(clause, NIL), or_selectivities));
|
||||
return compute_selec(root, lcons(clause, NIL), or_selectivities);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ compute_selec(Query *root, List *clauses, List *or_selectivities)
|
||||
*/
|
||||
|
||||
if (length(clauses) < 2)
|
||||
return (s1);
|
||||
return s1;
|
||||
else
|
||||
{
|
||||
/* Compute selectivity of the 'or'ed subclauses. */
|
||||
@@ -361,6 +361,6 @@ compute_selec(Query *root, List *clauses, List *or_selectivities)
|
||||
s2 = compute_selec(root, lnext(clauses), lnext(or_selectivities));
|
||||
else
|
||||
s2 = compute_selec(root, lnext(clauses), NIL);
|
||||
return (s1 + s2 - s1 * s2);
|
||||
return s1 + s2 - s1 * s2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.23 1998/08/04 16:44:04 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.24 1998/09/01 03:23:20 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -95,7 +95,7 @@ cost_seqscan(int relid, int relpages, int reltuples)
|
||||
temp += _cpu_page_wight_ * reltuples;
|
||||
}
|
||||
Assert(temp >= 0);
|
||||
return (temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ cost_index(Oid indexid,
|
||||
temp = temp + (_cpu_page_wight_ * selec * reltuples);
|
||||
|
||||
Assert(temp >= 0);
|
||||
return (temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -186,7 +186,7 @@ cost_sort(List *keys, int tuples, int width, bool noread)
|
||||
if (tuples == 0 || keys == NULL)
|
||||
{
|
||||
Assert(temp >= 0);
|
||||
return (temp);
|
||||
return temp;
|
||||
}
|
||||
temp += pages * base_log((double) pages, (double) 2.0);
|
||||
|
||||
@@ -201,7 +201,7 @@ cost_sort(List *keys, int tuples, int width, bool noread)
|
||||
temp = temp + cost_seqscan(_TEMP_RELATION_ID_, npages, tuples);
|
||||
Assert(temp >= 0);
|
||||
|
||||
return (temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ cost_result(int tuples, int width)
|
||||
temp = temp + page_size(tuples, width);
|
||||
temp = temp + _cpu_page_wight_ * tuples;
|
||||
Assert(temp >= 0);
|
||||
return (temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -255,7 +255,7 @@ cost_nestloop(Cost outercost,
|
||||
temp += outertuples * innercost;
|
||||
Assert(temp >= 0);
|
||||
|
||||
return (temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -294,7 +294,7 @@ cost_mergejoin(Cost outercost,
|
||||
temp += _cpu_page_wight_ * (outersize + innersize);
|
||||
Assert(temp >= 0);
|
||||
|
||||
return (temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -346,7 +346,7 @@ cost_hashjoin(Cost outercost,
|
||||
temp += _cpu_page_wight_ * (outersize + nrun * innersize);
|
||||
Assert(temp >= 0);
|
||||
|
||||
return (temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -373,7 +373,7 @@ compute_rel_size(RelOptInfo *rel)
|
||||
temp1 = ceil((double) temp);
|
||||
Assert(temp1 >= 0);
|
||||
Assert(temp1 <= MAXINT);
|
||||
return (temp1);
|
||||
return temp1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -385,7 +385,7 @@ compute_rel_size(RelOptInfo *rel)
|
||||
int
|
||||
compute_rel_width(RelOptInfo *rel)
|
||||
{
|
||||
return (compute_targetlist_width(get_actual_tlist(rel->targetlist)));
|
||||
return compute_targetlist_width(get_actual_tlist(rel->targetlist));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -405,7 +405,7 @@ compute_targetlist_width(List *targetlist)
|
||||
tuple_width = tuple_width +
|
||||
compute_attribute_width(lfirst(temp_tl));
|
||||
}
|
||||
return (tuple_width);
|
||||
return tuple_width;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -423,9 +423,9 @@ compute_attribute_width(TargetEntry *tlistentry)
|
||||
int width = get_typlen(tlistentry->resdom->restype);
|
||||
|
||||
if (width < 0)
|
||||
return (_DEFAULT_ATTRIBUTE_WIDTH_);
|
||||
return _DEFAULT_ATTRIBUTE_WIDTH_;
|
||||
else
|
||||
return (width);
|
||||
return width;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -457,7 +457,7 @@ compute_joinrel_size(JoinPath *joinpath)
|
||||
}
|
||||
Assert(temp1 >= 0);
|
||||
|
||||
return (temp1);
|
||||
return temp1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -473,11 +473,11 @@ page_size(int tuples, int width)
|
||||
temp = ceil((double) (tuples * (width + sizeof(HeapTupleData)))
|
||||
/ BLCKSZ);
|
||||
Assert(temp >= 0);
|
||||
return (temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
static double
|
||||
base_log(double x, double b)
|
||||
{
|
||||
return (log(x) / log(b));
|
||||
return log(x) / log(b);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.5 1998/02/26 04:32:30 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.6 1998/09/01 03:23:22 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -39,13 +39,13 @@ group_clauses_by_hashop(List *clauseinfo_list,
|
||||
int inner_relid)
|
||||
{
|
||||
List *hashinfo_list = NIL;
|
||||
CInfo *clauseinfo = (CInfo *) NULL;
|
||||
ClauseInfo *clauseinfo = (ClauseInfo *) NULL;
|
||||
List *i = NIL;
|
||||
Oid hashjoinop = 0;
|
||||
|
||||
foreach(i, clauseinfo_list)
|
||||
{
|
||||
clauseinfo = (CInfo *) lfirst(i);
|
||||
clauseinfo = (ClauseInfo *) lfirst(i);
|
||||
hashjoinop = clauseinfo->hashjoinoperator;
|
||||
|
||||
/*
|
||||
@@ -96,7 +96,7 @@ group_clauses_by_hashop(List *clauseinfo_list,
|
||||
lcons(keys, xhashinfo->jmethod.jmkeys);
|
||||
}
|
||||
}
|
||||
return (hashinfo_list);
|
||||
return hashinfo_list;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,8 +121,8 @@ match_hashop_hashinfo(Oid hashop, List *hashinfo_list)
|
||||
key = xhashinfo->hashop;
|
||||
if (hashop == key)
|
||||
{ /* found */
|
||||
return (xhashinfo); /* should be a hashinfo node ! */
|
||||
return xhashinfo; /* should be a hashinfo node ! */
|
||||
}
|
||||
}
|
||||
return ((HInfo *) NIL);
|
||||
return (HInfo *) NIL;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.32 1998/08/31 07:19:54 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.33 1998/09/01 03:23:23 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -60,9 +60,9 @@ group_clauses_by_indexkey(RelOptInfo *rel, RelOptInfo *index,
|
||||
static List *
|
||||
group_clauses_by_ikey_for_joins(RelOptInfo *rel, RelOptInfo *index,
|
||||
int *indexkeys, Oid *classes, List *join_cinfo_list, List *restr_cinfo_list);
|
||||
static CInfo *
|
||||
static ClauseInfo *
|
||||
match_clause_to_indexkey(RelOptInfo *rel, RelOptInfo *index, int indexkey,
|
||||
int xclass, CInfo *clauseInfo, bool join);
|
||||
int xclass, ClauseInfo *clauseInfo, bool join);
|
||||
static bool
|
||||
pred_test(List *predicate_list, List *clauseinfo_list,
|
||||
List *joininfo_list);
|
||||
@@ -231,12 +231,12 @@ match_index_orclauses(RelOptInfo *rel,
|
||||
int xclass,
|
||||
List *clauseinfo_list)
|
||||
{
|
||||
CInfo *clauseinfo = (CInfo *) NULL;
|
||||
ClauseInfo *clauseinfo = (ClauseInfo *) NULL;
|
||||
List *i = NIL;
|
||||
|
||||
foreach(i, clauseinfo_list)
|
||||
{
|
||||
clauseinfo = (CInfo *) lfirst(i);
|
||||
clauseinfo = (ClauseInfo *) lfirst(i);
|
||||
if (valid_or_clause(clauseinfo))
|
||||
{
|
||||
|
||||
@@ -350,7 +350,7 @@ match_index_orclause(RelOptInfo *rel,
|
||||
|
||||
matching_indices = lnext(matching_indices);
|
||||
}
|
||||
return (index_list);
|
||||
return index_list;
|
||||
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ group_clauses_by_indexkey(RelOptInfo *rel,
|
||||
List *clauseinfo_list)
|
||||
{
|
||||
List *curCinfo = NIL;
|
||||
CInfo *matched_clause = (CInfo *) NULL;
|
||||
ClauseInfo *matched_clause = (ClauseInfo *) NULL;
|
||||
List *clausegroup = NIL;
|
||||
int curIndxKey;
|
||||
Oid curClass;
|
||||
@@ -420,7 +420,7 @@ group_clauses_by_indexkey(RelOptInfo *rel,
|
||||
|
||||
foreach(curCinfo, clauseinfo_list)
|
||||
{
|
||||
CInfo *temp = (CInfo *) lfirst(curCinfo);
|
||||
ClauseInfo *temp = (ClauseInfo *) lfirst(curCinfo);
|
||||
|
||||
matched_clause = match_clause_to_indexkey(rel,
|
||||
index,
|
||||
@@ -446,7 +446,7 @@ group_clauses_by_indexkey(RelOptInfo *rel,
|
||||
/* clausegroup holds all matched clauses ordered by indexkeys */
|
||||
|
||||
if (clausegroup != NIL)
|
||||
return (lcons(clausegroup, NIL));
|
||||
return lcons(clausegroup, NIL);
|
||||
return NIL;
|
||||
}
|
||||
|
||||
@@ -466,7 +466,7 @@ group_clauses_by_ikey_for_joins(RelOptInfo *rel,
|
||||
List *restr_cinfo_list)
|
||||
{
|
||||
List *curCinfo = NIL;
|
||||
CInfo *matched_clause = (CInfo *) NULL;
|
||||
ClauseInfo *matched_clause = (ClauseInfo *) NULL;
|
||||
List *clausegroup = NIL;
|
||||
int curIndxKey;
|
||||
Oid curClass;
|
||||
@@ -484,7 +484,7 @@ group_clauses_by_ikey_for_joins(RelOptInfo *rel,
|
||||
|
||||
foreach(curCinfo, join_cinfo_list)
|
||||
{
|
||||
CInfo *temp = (CInfo *) lfirst(curCinfo);
|
||||
ClauseInfo *temp = (ClauseInfo *) lfirst(curCinfo);
|
||||
|
||||
matched_clause = match_clause_to_indexkey(rel,
|
||||
index,
|
||||
@@ -500,7 +500,7 @@ group_clauses_by_ikey_for_joins(RelOptInfo *rel,
|
||||
}
|
||||
foreach(curCinfo, restr_cinfo_list)
|
||||
{
|
||||
CInfo *temp = (CInfo *) lfirst(curCinfo);
|
||||
ClauseInfo *temp = (ClauseInfo *) lfirst(curCinfo);
|
||||
|
||||
matched_clause = match_clause_to_indexkey(rel,
|
||||
index,
|
||||
@@ -537,7 +537,7 @@ group_clauses_by_ikey_for_joins(RelOptInfo *rel,
|
||||
freeList(clausegroup);
|
||||
return NIL;
|
||||
}
|
||||
return (lcons(clausegroup, NIL));
|
||||
return lcons(clausegroup, NIL);
|
||||
}
|
||||
return NIL;
|
||||
}
|
||||
@@ -579,12 +579,12 @@ group_clauses_by_ikey_for_joins(RelOptInfo *rel,
|
||||
* NOTE: returns nil if clause is an or_clause.
|
||||
*
|
||||
*/
|
||||
static CInfo *
|
||||
static ClauseInfo *
|
||||
match_clause_to_indexkey(RelOptInfo *rel,
|
||||
RelOptInfo *index,
|
||||
int indexkey,
|
||||
int xclass,
|
||||
CInfo *clauseInfo,
|
||||
ClauseInfo *clauseInfo,
|
||||
bool join)
|
||||
{
|
||||
Expr *clause = clauseInfo->clause;
|
||||
@@ -596,7 +596,7 @@ match_clause_to_indexkey(RelOptInfo *rel,
|
||||
|
||||
if (or_clause((Node *) clause) ||
|
||||
not_clause((Node *) clause) || single_node((Node *) clause))
|
||||
return ((CInfo *) NULL);
|
||||
return (ClauseInfo *) NULL;
|
||||
|
||||
leftop = get_leftop(clause);
|
||||
rightop = get_rightop(clause);
|
||||
@@ -771,9 +771,9 @@ match_clause_to_indexkey(RelOptInfo *rel,
|
||||
}
|
||||
|
||||
if (isIndexable)
|
||||
return (clauseInfo);
|
||||
return clauseInfo;
|
||||
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -848,13 +848,13 @@ pred_test(List *predicate_list, List *clauseinfo_list, List *joininfo_list)
|
||||
static bool
|
||||
one_pred_test(Expr *predicate, List *clauseinfo_list)
|
||||
{
|
||||
CInfo *clauseinfo;
|
||||
ClauseInfo *clauseinfo;
|
||||
List *item;
|
||||
|
||||
Assert(predicate != NULL);
|
||||
foreach(item, clauseinfo_list)
|
||||
{
|
||||
clauseinfo = (CInfo *) lfirst(item);
|
||||
clauseinfo = (ClauseInfo *) lfirst(item);
|
||||
/* if any clause implies the predicate, return true */
|
||||
if (one_pred_clause_expr_test(predicate, (Node *) clauseinfo->clause))
|
||||
return true;
|
||||
@@ -1187,7 +1187,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
|
||||
*
|
||||
* Returns a list of these clause groups.
|
||||
*
|
||||
* Added: clauseinfo_list - list of restriction CInfos. It's to
|
||||
* Added: clauseinfo_list - list of restriction ClauseInfos. It's to
|
||||
* support multi-column indices in joins and for cases
|
||||
* when a key is in both join & restriction clauses. - vadim 03/18/97
|
||||
*
|
||||
@@ -1196,14 +1196,14 @@ static List *
|
||||
indexable_joinclauses(RelOptInfo *rel, RelOptInfo *index,
|
||||
List *joininfo_list, List *clauseinfo_list)
|
||||
{
|
||||
JInfo *joininfo = (JInfo *) NULL;
|
||||
JoinInfo *joininfo = (JoinInfo *) NULL;
|
||||
List *cg_list = NIL;
|
||||
List *i = NIL;
|
||||
List *clausegroups = NIL;
|
||||
|
||||
foreach(i, joininfo_list)
|
||||
{
|
||||
joininfo = (JInfo *) lfirst(i);
|
||||
joininfo = (JoinInfo *) lfirst(i);
|
||||
|
||||
if (joininfo->jinfoclauseinfo == NIL)
|
||||
continue;
|
||||
@@ -1219,12 +1219,12 @@ indexable_joinclauses(RelOptInfo *rel, RelOptInfo *index,
|
||||
{
|
||||
List *clauses = lfirst(clausegroups);
|
||||
|
||||
((CInfo *) lfirst(clauses))->cinfojoinid =
|
||||
((ClauseInfo *) lfirst(clauses))->cinfojoinid =
|
||||
joininfo->otherrels;
|
||||
}
|
||||
cg_list = nconc(cg_list, clausegroups);
|
||||
}
|
||||
return (cg_list);
|
||||
return cg_list;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -1245,7 +1245,7 @@ extract_restrict_clauses(List *clausegroup)
|
||||
|
||||
foreach(l, clausegroup)
|
||||
{
|
||||
CInfo *cinfo = lfirst(l);
|
||||
ClauseInfo *cinfo = lfirst(l);
|
||||
|
||||
if (!is_joinable((Node *) cinfo->clause))
|
||||
restrict_cls = lappend(restrict_cls, cinfo);
|
||||
@@ -1305,7 +1305,7 @@ index_innerjoin(Query *root, RelOptInfo *rel, List *clausegroup_list,
|
||||
pathnode->indexkeys = index->indexkeys;
|
||||
pathnode->indexqual = clausegroup;
|
||||
|
||||
pathnode->path.joinid = ((CInfo *) lfirst(clausegroup))->cinfojoinid;
|
||||
pathnode->path.joinid = ((ClauseInfo *) lfirst(clausegroup))->cinfojoinid;
|
||||
|
||||
pathnode->path.path_cost =
|
||||
cost_index((Oid) lfirsti(index->relids),
|
||||
@@ -1335,7 +1335,7 @@ index_innerjoin(Query *root, RelOptInfo *rel, List *clausegroup_list,
|
||||
#endif
|
||||
cg_list = lappend(cg_list, pathnode);
|
||||
}
|
||||
return (cg_list);
|
||||
return cg_list;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1367,7 +1367,7 @@ create_index_paths(Query *root,
|
||||
|
||||
foreach(i, clausegroup_list)
|
||||
{
|
||||
CInfo *clauseinfo;
|
||||
ClauseInfo *clauseinfo;
|
||||
List *temp_node = NIL;
|
||||
bool temp = true;
|
||||
|
||||
@@ -1375,7 +1375,7 @@ create_index_paths(Query *root,
|
||||
|
||||
foreach(j, clausegroup)
|
||||
{
|
||||
clauseinfo = (CInfo *) lfirst(j);
|
||||
clauseinfo = (ClauseInfo *) lfirst(j);
|
||||
if (!(is_joinable((Node *) clauseinfo->clause) &&
|
||||
equal_path_merge_ordering(index->ordering,
|
||||
clauseinfo->mergejoinorder)))
|
||||
@@ -1389,7 +1389,7 @@ create_index_paths(Query *root,
|
||||
ip_list = nconc(ip_list, temp_node);
|
||||
}
|
||||
}
|
||||
return (ip_list);
|
||||
return ip_list;
|
||||
}
|
||||
|
||||
static List *
|
||||
@@ -1447,10 +1447,10 @@ function_index_operand(Expr *funcOpnd, RelOptInfo *rel, RelOptInfo *index)
|
||||
{
|
||||
|
||||
if (indexKeys[i] == 0)
|
||||
return (false);
|
||||
return false;
|
||||
|
||||
if (((Var *) lfirst(arg))->varattno != indexKeys[i])
|
||||
return (false);
|
||||
return false;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.8 1998/08/04 16:44:07 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.9 1998/09/01 03:23:24 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -221,7 +221,7 @@ best_innerjoin(List *join_paths, List *outer_relids)
|
||||
cheapest = (Path *) lfirst(join_path);
|
||||
}
|
||||
}
|
||||
return (cheapest);
|
||||
return cheapest;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -285,7 +285,7 @@ sort_inner_and_outer(RelOptInfo *joinrel,
|
||||
|
||||
ms_list = lappend(ms_list, temp_node);
|
||||
}
|
||||
return (ms_list);
|
||||
return ms_list;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -442,7 +442,7 @@ match_unsorted_outer(RelOptInfo *joinrel,
|
||||
temp_node = paths;
|
||||
jp_list = nconc(jp_list, temp_node);
|
||||
}
|
||||
return (jp_list);
|
||||
return jp_list;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -560,7 +560,7 @@ match_unsorted_inner(RelOptInfo *joinrel,
|
||||
}
|
||||
}
|
||||
}
|
||||
return (mp_list);
|
||||
return mp_list;
|
||||
|
||||
}
|
||||
|
||||
@@ -645,5 +645,5 @@ hash_inner_and_outer(RelOptInfo *joinrel,
|
||||
hjoin_list = lappend(hjoin_list, temp_node);
|
||||
}
|
||||
}
|
||||
return (hjoin_list);
|
||||
return hjoin_list;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.13 1998/08/10 02:26:24 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.14 1998/09/01 03:23:25 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -33,7 +33,7 @@ bool _use_right_sided_plans_ = false;
|
||||
|
||||
static List *find_clause_joins(Query *root, RelOptInfo *outer_rel, List *joininfo_list);
|
||||
static List *find_clauseless_joins(RelOptInfo *outer_rel, List *inner_rels);
|
||||
static RelOptInfo *init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JInfo *joininfo);
|
||||
static RelOptInfo *init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo *joininfo);
|
||||
static List *
|
||||
new_join_tlist(List *tlist, List *other_relids,
|
||||
int first_resdomno);
|
||||
@@ -43,7 +43,7 @@ static bool nonoverlap_rels(RelOptInfo *rel1, RelOptInfo *rel2);
|
||||
static bool nonoverlap_sets(List *s1, List *s2);
|
||||
static void
|
||||
set_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel,
|
||||
JInfo *jinfo);
|
||||
JoinInfo *jinfo);
|
||||
|
||||
/*
|
||||
* find-join-rels--
|
||||
@@ -80,7 +80,7 @@ find_join_rels(Query *root, List *outer_rels)
|
||||
join_list = nconc(join_list, joins);
|
||||
}
|
||||
|
||||
return (join_list);
|
||||
return join_list;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -106,7 +106,7 @@ find_clause_joins(Query *root, RelOptInfo *outer_rel, List *joininfo_list)
|
||||
|
||||
foreach(i, joininfo_list)
|
||||
{
|
||||
JInfo *joininfo = (JInfo *) lfirst(i);
|
||||
JoinInfo *joininfo = (JoinInfo *) lfirst(i);
|
||||
RelOptInfo *rel;
|
||||
|
||||
if (!joininfo->inactive)
|
||||
@@ -146,7 +146,7 @@ find_clause_joins(Query *root, RelOptInfo *outer_rel, List *joininfo_list)
|
||||
}
|
||||
}
|
||||
|
||||
return (join_list);
|
||||
return join_list;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -172,13 +172,13 @@ find_clauseless_joins(RelOptInfo *outer_rel, List *inner_rels)
|
||||
{
|
||||
temp_node = lcons(init_join_rel(outer_rel,
|
||||
inner_rel,
|
||||
(JInfo *) NULL),
|
||||
(JoinInfo *) NULL),
|
||||
NIL);
|
||||
t_list = nconc(t_list, temp_node);
|
||||
}
|
||||
}
|
||||
|
||||
return (t_list);
|
||||
return t_list;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -193,7 +193,7 @@ find_clauseless_joins(RelOptInfo *outer_rel, List *inner_rels)
|
||||
* Returns the new join relation node.
|
||||
*/
|
||||
static RelOptInfo *
|
||||
init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JInfo *joininfo)
|
||||
init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo *joininfo)
|
||||
{
|
||||
RelOptInfo *joinrel = makeNode(RelOptInfo);
|
||||
List *joinrel_joininfo_list = NIL;
|
||||
@@ -253,7 +253,7 @@ init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JInfo *joininfo)
|
||||
|
||||
set_joinrel_size(joinrel, outer_rel, inner_rel, joininfo);
|
||||
|
||||
return (joinrel);
|
||||
return joinrel;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -301,7 +301,7 @@ new_join_tlist(List *tlist,
|
||||
}
|
||||
}
|
||||
|
||||
return (t_list);
|
||||
return t_list;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -327,13 +327,13 @@ new_joininfo_list(List *joininfo_list, List *join_relids)
|
||||
{
|
||||
List *current_joininfo_list = NIL;
|
||||
List *new_otherrels = NIL;
|
||||
JInfo *other_joininfo = (JInfo *) NULL;
|
||||
JoinInfo *other_joininfo = (JoinInfo *) NULL;
|
||||
List *xjoininfo = NIL;
|
||||
|
||||
foreach(xjoininfo, joininfo_list)
|
||||
{
|
||||
List *or;
|
||||
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
|
||||
JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
|
||||
|
||||
new_otherrels = joininfo->otherrels;
|
||||
foreach(or, new_otherrels)
|
||||
@@ -354,7 +354,7 @@ new_joininfo_list(List *joininfo_list, List *join_relids)
|
||||
}
|
||||
else
|
||||
{
|
||||
other_joininfo = makeNode(JInfo);
|
||||
other_joininfo = makeNode(JoinInfo);
|
||||
|
||||
other_joininfo->otherrels =
|
||||
joininfo->otherrels;
|
||||
@@ -372,7 +372,7 @@ new_joininfo_list(List *joininfo_list, List *join_relids)
|
||||
}
|
||||
}
|
||||
|
||||
return (current_joininfo_list);
|
||||
return current_joininfo_list;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -412,7 +412,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
|
||||
|
||||
foreach(xjoininfo, joinrel->joininfo)
|
||||
{
|
||||
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
|
||||
JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
|
||||
List *other_rels = joininfo->otherrels;
|
||||
List *clause_info = joininfo->jinfoclauseinfo;
|
||||
bool mergejoinable = joininfo->mergejoinable;
|
||||
@@ -424,7 +424,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
|
||||
RelOptInfo *rel = get_join_rel(root, relid);
|
||||
List *super_rels = rel->superrels;
|
||||
List *xsuper_rel = NIL;
|
||||
JInfo *new_joininfo = makeNode(JInfo);
|
||||
JoinInfo *new_joininfo = makeNode(JoinInfo);
|
||||
|
||||
new_joininfo->otherrels = joinrel->relids;
|
||||
new_joininfo->jinfoclauseinfo = clause_info;
|
||||
@@ -441,7 +441,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
|
||||
if (nonoverlap_rels(super_rel, joinrel))
|
||||
{
|
||||
List *new_relids = super_rel->relids;
|
||||
JInfo *other_joininfo =
|
||||
JoinInfo *other_joininfo =
|
||||
joininfo_member(new_relids,
|
||||
joinrel->joininfo);
|
||||
|
||||
@@ -453,7 +453,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
|
||||
}
|
||||
else
|
||||
{
|
||||
JInfo *new_joininfo = makeNode(JInfo);
|
||||
JoinInfo *new_joininfo = makeNode(JoinInfo);
|
||||
|
||||
new_joininfo->otherrels = new_relids;
|
||||
new_joininfo->jinfoclauseinfo = clause_info;
|
||||
@@ -505,7 +505,7 @@ final_join_rels(List *join_rel_list)
|
||||
|
||||
foreach(xjoininfo, rel->joininfo)
|
||||
{
|
||||
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
|
||||
JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
|
||||
|
||||
if (joininfo->otherrels != NIL)
|
||||
{
|
||||
@@ -520,7 +520,7 @@ final_join_rels(List *join_rel_list)
|
||||
}
|
||||
}
|
||||
|
||||
return (t_list);
|
||||
return t_list;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -550,7 +550,7 @@ add_superrels(RelOptInfo *rel, RelOptInfo *super_rel)
|
||||
static bool
|
||||
nonoverlap_rels(RelOptInfo *rel1, RelOptInfo *rel2)
|
||||
{
|
||||
return (nonoverlap_sets(rel1->relids, rel2->relids));
|
||||
return nonoverlap_sets(rel1->relids, rel2->relids);
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -563,13 +563,13 @@ nonoverlap_sets(List *s1, List *s2)
|
||||
int e = lfirsti(x);
|
||||
|
||||
if (intMember(e, s2))
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
return (true);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
set_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, JInfo *jinfo)
|
||||
set_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo *jinfo)
|
||||
{
|
||||
int ntuples;
|
||||
float selec;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.6 1998/06/15 19:28:41 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.7 1998/09/01 03:23:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -106,7 +106,7 @@ match_pathkeys_joinkeys(List *pathkeys,
|
||||
joinkeys = LispRemove(xjoinkey, joinkeys);
|
||||
}
|
||||
else
|
||||
return (NIL);
|
||||
return NIL;
|
||||
|
||||
}
|
||||
if (matched_joinkeys == NULL ||
|
||||
@@ -114,7 +114,7 @@ match_pathkeys_joinkeys(List *pathkeys,
|
||||
return NIL;
|
||||
|
||||
*matchedJoinClausesPtr = nreverse(matched_joinclauses);
|
||||
return (nreverse(matched_joinkeys));
|
||||
return nreverse(matched_joinkeys);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -142,11 +142,11 @@ match_pathkey_joinkeys(List *pathkey,
|
||||
jk = (JoinKey *) lfirst(x);
|
||||
if (var_equal(path_subkey,
|
||||
extract_subkey(jk, which_subkey)))
|
||||
return (pos);
|
||||
return pos;
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
return (-1); /* no index found */
|
||||
return -1; /* no index found */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -197,9 +197,9 @@ every_func(List *joinkeys, List *pathkey, int which_subkey)
|
||||
}
|
||||
}
|
||||
if (found == false)
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
return (found);
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ extract_path_keys(List *joinkeys,
|
||||
pathkeys =
|
||||
lappend(pathkeys, lcons(key, NIL));
|
||||
}
|
||||
return (pathkeys);
|
||||
return pathkeys;
|
||||
}
|
||||
|
||||
|
||||
@@ -337,7 +337,7 @@ new_join_pathkeys(List *outer_pathkeys,
|
||||
if (x != NIL)
|
||||
t_list = lappend(t_list, x);
|
||||
}
|
||||
return (t_list);
|
||||
return t_list;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -395,7 +395,7 @@ new_join_pathkey(List *subkeys,
|
||||
|
||||
t_list = nconc(t_list, newly_considered_subkeys);
|
||||
}
|
||||
return (t_list);
|
||||
return t_list;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -451,5 +451,5 @@ new_matching_subkeys(Var *subkey,
|
||||
t_list = nconc(t_list, temp);
|
||||
}
|
||||
}
|
||||
return (t_list);
|
||||
return t_list;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.7 1998/08/04 16:44:10 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.8 1998/09/01 03:23:28 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -42,7 +42,7 @@ group_clauses_by_order(List *clauseinfo_list,
|
||||
|
||||
foreach(xclauseinfo, clauseinfo_list)
|
||||
{
|
||||
CInfo *clauseinfo = (CInfo *) lfirst(xclauseinfo);
|
||||
ClauseInfo *clauseinfo = (ClauseInfo *) lfirst(xclauseinfo);
|
||||
MergeOrder *merge_ordering = clauseinfo->mergejoinorder;
|
||||
|
||||
if (merge_ordering)
|
||||
@@ -92,7 +92,7 @@ group_clauses_by_order(List *clauseinfo_list,
|
||||
((JoinMethod *) xmergeinfo)->jmkeys);
|
||||
}
|
||||
}
|
||||
return (mergeinfo_list);
|
||||
return mergeinfo_list;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,8 +122,8 @@ match_order_mergeinfo(PathOrder *ordering, List *mergeinfo_list)
|
||||
equal_path_merge_ordering(ordering->ord.sortop, xmergeorder)))
|
||||
{
|
||||
|
||||
return (mergeinfo);
|
||||
return mergeinfo;
|
||||
}
|
||||
}
|
||||
return ((MInfo *) NIL);
|
||||
return (MInfo *) NIL;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.9 1998/08/31 07:19:55 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.10 1998/09/01 03:23:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -59,7 +59,7 @@ create_or_index_paths(Query *root,
|
||||
|
||||
foreach(clist, clauses)
|
||||
{
|
||||
CInfo *clausenode = (CInfo *) (lfirst(clist));
|
||||
ClauseInfo *clausenode = (ClauseInfo *) (lfirst(clist));
|
||||
|
||||
/*
|
||||
* Check to see if this clause is an 'or' clause, and, if so,
|
||||
@@ -131,7 +131,7 @@ create_or_index_paths(Query *root,
|
||||
}
|
||||
}
|
||||
|
||||
return (t_list);
|
||||
return t_list;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.11 1998/06/15 19:28:41 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.12 1998/09/01 03:23:30 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -67,7 +67,7 @@ static void xfunc_free_stream(Stream root);
|
||||
static Stream xfunc_add_clauses(Stream current);
|
||||
static void xfunc_setup_group(Stream node, Stream bottom);
|
||||
static Stream
|
||||
xfunc_streaminsert(CInfo clauseinfo, Stream current,
|
||||
xfunc_streaminsert(ClauseInfo clauseinfo, Stream current,
|
||||
int clausetype);
|
||||
static int xfunc_num_relids(Stream node);
|
||||
static StreamPtr xfunc_get_downjoin(Stream node);
|
||||
@@ -102,7 +102,7 @@ xfunc_do_predmig(Path root)
|
||||
if (progress)
|
||||
changed = true;
|
||||
} while (progress);
|
||||
return (changed);
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ xfunc_predmig(JoinPath pathnode,/* root of the join tree */
|
||||
set_downstream(laststream, (StreamPtr) newstream);
|
||||
set_downstream(newstream, (StreamPtr) NULL);
|
||||
set_pathptr(newstream, (pathPtr) pathnode);
|
||||
set_cinfo(newstream, (CInfo) NULL);
|
||||
set_cinfo(newstream, (ClauseInfo) NULL);
|
||||
set_clausetype(newstream, XFUNC_UNKNOWN);
|
||||
|
||||
/* base case: we're at a leaf, call xfunc_series_llel */
|
||||
@@ -203,7 +203,7 @@ xfunc_series_llel(Stream stream)
|
||||
if (xfunc_llel_chains(stream, temp))
|
||||
progress = true;
|
||||
}
|
||||
return (progress);
|
||||
return progress;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -270,7 +270,7 @@ xfunc_llel_chains(Stream root, Stream bottom)
|
||||
|
||||
/* free up origstream */
|
||||
xfunc_free_stream(origstream);
|
||||
return (progress);
|
||||
return progress;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -304,7 +304,7 @@ xfunc_complete_stream(Stream stream)
|
||||
tmpstream = (Stream) get_upstream(tmpstream))
|
||||
/* no body in for loop */ ;
|
||||
|
||||
return (tmpstream);
|
||||
return tmpstream;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -318,7 +318,7 @@ xfunc_complete_stream(Stream stream)
|
||||
static bool
|
||||
xfunc_prdmig_pullup(Stream origstream, Stream pullme, JoinPath joinpath)
|
||||
{
|
||||
CInfo clauseinfo = get_cinfo(pullme);
|
||||
ClauseInfo clauseinfo = get_cinfo(pullme);
|
||||
bool progress = false;
|
||||
Stream upjoin,
|
||||
orignode,
|
||||
@@ -391,7 +391,7 @@ xfunc_prdmig_pullup(Stream origstream, Stream pullme, JoinPath joinpath)
|
||||
}
|
||||
if (!progress)
|
||||
elog(DEBUG, "didn't succeed in pulling up in xfunc_prdmig_pullup");
|
||||
return (progress);
|
||||
return progress;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -530,7 +530,7 @@ xfunc_add_clauses(Stream current)
|
||||
foreach(temp, get_locclauseinfo((Path) get_pathptr(current)))
|
||||
{
|
||||
topnode =
|
||||
xfunc_streaminsert((CInfo) lfirst(temp), topnode,
|
||||
xfunc_streaminsert((ClauseInfo) lfirst(temp), topnode,
|
||||
XFUNC_LOCPRD);
|
||||
}
|
||||
|
||||
@@ -540,13 +540,13 @@ xfunc_add_clauses(Stream current)
|
||||
primjoin = xfunc_primary_join((JoinPath) get_pathptr(current));
|
||||
foreach(temp, get_pathclauseinfo((JoinPath) get_pathptr(current)))
|
||||
{
|
||||
if (!equal(get_clause((CInfo) lfirst(temp)), primjoin))
|
||||
if (!equal(get_clause((ClauseInfo) lfirst(temp)), primjoin))
|
||||
topnode =
|
||||
xfunc_streaminsert((CInfo) lfirst(temp), topnode,
|
||||
xfunc_streaminsert((ClauseInfo) lfirst(temp), topnode,
|
||||
XFUNC_JOINPRD);
|
||||
}
|
||||
}
|
||||
return (topnode);
|
||||
return topnode;
|
||||
}
|
||||
|
||||
|
||||
@@ -596,7 +596,7 @@ xfunc_setup_group(Stream node, Stream bottom)
|
||||
** Return new node.
|
||||
*/
|
||||
static Stream
|
||||
xfunc_streaminsert(CInfo clauseinfo,
|
||||
xfunc_streaminsert(ClauseInfo clauseinfo,
|
||||
Stream current,
|
||||
int clausetype) /* XFUNC_LOCPRD or XFUNC_JOINPRD */
|
||||
{
|
||||
@@ -610,7 +610,7 @@ xfunc_streaminsert(CInfo clauseinfo,
|
||||
set_pathptr(newstream, get_pathptr(current));
|
||||
set_cinfo(newstream, clauseinfo);
|
||||
set_clausetype(newstream, clausetype);
|
||||
return (newstream);
|
||||
return newstream;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -623,7 +623,7 @@ static int
|
||||
xfunc_num_relids(Stream node)
|
||||
{
|
||||
if (!node || !IsA(get_pathptr(node), JoinPath))
|
||||
return (0);
|
||||
return 0;
|
||||
else
|
||||
return (length
|
||||
(get_relids(get_parent((JoinPath) get_pathptr(node)))));
|
||||
@@ -645,7 +645,7 @@ xfunc_get_downjoin(Stream node)
|
||||
temp = (Stream) get_downstream(temp))
|
||||
/* empty body in for loop */ ;
|
||||
|
||||
return ((StreamPtr) temp);
|
||||
return (StreamPtr) temp;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -663,7 +663,7 @@ xfunc_get_upjoin(Stream node)
|
||||
temp = (Stream) get_upstream(temp))
|
||||
/* empty body in for loop */ ;
|
||||
|
||||
return ((StreamPtr) temp);
|
||||
return (StreamPtr) temp;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -685,7 +685,7 @@ xfunc_stream_qsort(Stream root, Stream bottom)
|
||||
tmp = (Stream) get_downstream(tmp))
|
||||
num++;
|
||||
if (num <= 1)
|
||||
return (root);
|
||||
return root;
|
||||
|
||||
/* copy elements of the list into an array */
|
||||
nodearray = (Stream *) palloc(num * sizeof(Stream));
|
||||
@@ -710,7 +710,7 @@ xfunc_stream_qsort(Stream root, Stream bottom)
|
||||
set_upstream(bottom, (StreamPtr) nodearray[0]);
|
||||
|
||||
Assert(xfunc_check_stream(output));
|
||||
return (output);
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -731,33 +731,33 @@ xfunc_stream_compare(void *arg1, void *arg2)
|
||||
rank2 = get_grouprank(stream2);
|
||||
|
||||
if (rank1 > rank2)
|
||||
return (1);
|
||||
return 1;
|
||||
else if (rank1 < rank2)
|
||||
return (-1);
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
if (is_clause(stream1) && is_clause(stream2))
|
||||
return (0); /* doesn't matter what order if both are
|
||||
return 0; /* doesn't matter what order if both are
|
||||
* restrictions */
|
||||
else if (!is_clause(stream1) && !is_clause(stream2))
|
||||
{
|
||||
if (xfunc_num_relids(stream1) < xfunc_num_relids(stream2))
|
||||
return (-1);
|
||||
return -1;
|
||||
else
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
else if (is_clause(stream1) && !is_clause(stream2))
|
||||
{
|
||||
if (xfunc_num_relids(stream1) == xfunc_num_relids(stream2))
|
||||
/* stream1 is a restriction over stream2 */
|
||||
return (1);
|
||||
return 1;
|
||||
else
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
else if (!is_clause(stream1) && is_clause(stream2))
|
||||
{
|
||||
/* stream2 is a restriction over stream1: never push down */
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -788,20 +788,20 @@ xfunc_check_stream(Stream node)
|
||||
if ((Stream) get_upstream((Stream) get_downstream(temp)) != temp)
|
||||
{
|
||||
elog(ERROR, "bad pointers in stream");
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
if (!is_clause(temp))
|
||||
{
|
||||
if ((tmp = xfunc_num_relids(temp)) >= numrelids)
|
||||
{
|
||||
elog(ERROR, "Joins got reordered!");
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
numrelids = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
return (true);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -815,6 +815,6 @@ xfunc_in_stream(Stream node, Stream stream)
|
||||
|
||||
for (temp = stream; temp; temp = (Stream) get_downstream(temp))
|
||||
if (temp == node)
|
||||
return (1);
|
||||
return (0);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.15 1998/07/18 04:22:34 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.16 1998/09/01 03:23:32 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -77,7 +77,7 @@ prune_joinrel(RelOptInfo *rel, List *other_rels)
|
||||
else
|
||||
result = nconc(result, lcons(other_rel, NIL));
|
||||
}
|
||||
return (result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -145,7 +145,7 @@ prune_rel_path(RelOptInfo *rel, Path *unorderedpath)
|
||||
else
|
||||
rel->unorderedpath = (Path *) unorderedpath;
|
||||
|
||||
return (cheapest);
|
||||
return cheapest;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -169,7 +169,7 @@ merge_joinrels(List *rel_list1, List *rel_list2)
|
||||
|
||||
rel_list2 = prune_joinrel(rel, rel_list2);
|
||||
}
|
||||
return (append(rel_list1, rel_list2));
|
||||
return append(rel_list1, rel_list2);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -204,7 +204,7 @@ prune_oldrels(List *old_rels)
|
||||
{
|
||||
foreach(xjoininfo, joininfo_list)
|
||||
{
|
||||
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
|
||||
JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
|
||||
|
||||
if (!joininfo->inactive)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.20 1998/08/24 01:37:53 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.21 1998/09/01 03:23:33 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -60,7 +60,7 @@ void
|
||||
xfunc_trypullup(RelOptInfo rel)
|
||||
{
|
||||
LispValue y; /* list ptr */
|
||||
CInfo maxcinfo; /* The CInfo to pull up, as calculated by
|
||||
ClauseInfo maxcinfo; /* The ClauseInfo to pull up, as calculated by
|
||||
* xfunc_shouldpull() */
|
||||
JoinPath curpath; /* current path in list */
|
||||
int progress; /* has progress been made this time
|
||||
@@ -147,12 +147,12 @@ xfunc_shouldpull(Query *queryInfo,
|
||||
Path childpath,
|
||||
JoinPath parentpath,
|
||||
int whichchild,
|
||||
CInfo *maxcinfopt) /* Out: pointer to clause to
|
||||
ClauseInfo *maxcinfopt) /* Out: pointer to clause to
|
||||
* pullup */
|
||||
{
|
||||
LispValue clauselist,
|
||||
tmplist; /* lists of clauses */
|
||||
CInfo maxcinfo; /* clause to pullup */
|
||||
ClauseInfo maxcinfo; /* clause to pullup */
|
||||
LispValue primjoinclause /* primary join clause */
|
||||
= xfunc_primary_join(parentpath);
|
||||
Cost tmprank,
|
||||
@@ -167,16 +167,16 @@ xfunc_shouldpull(Query *queryInfo,
|
||||
{
|
||||
/* find local predicate with maximum rank */
|
||||
for (tmplist = clauselist,
|
||||
maxcinfo = (CInfo) lfirst(tmplist),
|
||||
maxcinfo = (ClauseInfo) lfirst(tmplist),
|
||||
maxrank = xfunc_rank(get_clause(maxcinfo));
|
||||
tmplist != LispNil;
|
||||
tmplist = lnext(tmplist))
|
||||
{
|
||||
|
||||
if ((tmprank = xfunc_rank(get_clause((CInfo) lfirst(tmplist))))
|
||||
if ((tmprank = xfunc_rank(get_clause((ClauseInfo) lfirst(tmplist))))
|
||||
> maxrank)
|
||||
{
|
||||
maxcinfo = (CInfo) lfirst(tmplist);
|
||||
maxcinfo = (ClauseInfo) lfirst(tmplist);
|
||||
maxrank = tmprank;
|
||||
}
|
||||
}
|
||||
@@ -194,16 +194,16 @@ xfunc_shouldpull(Query *queryInfo,
|
||||
{
|
||||
|
||||
if (tmplist != LispNil &&
|
||||
(tmprank = xfunc_rank(get_clause((CInfo) lfirst(tmplist))))
|
||||
(tmprank = xfunc_rank(get_clause((ClauseInfo) lfirst(tmplist))))
|
||||
> maxrank)
|
||||
{
|
||||
maxcinfo = (CInfo) lfirst(tmplist);
|
||||
maxcinfo = (ClauseInfo) lfirst(tmplist);
|
||||
maxrank = tmprank;
|
||||
retval = XFUNC_JOINPRD;
|
||||
}
|
||||
}
|
||||
if (maxrank == (-1 * MAXFLOAT)) /* no expensive clauses */
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* * Pullup over join if clause is higher rank than join, or if * join
|
||||
@@ -233,7 +233,7 @@ xfunc_shouldpull(Query *queryInfo,
|
||||
{
|
||||
|
||||
*maxcinfopt = maxcinfo;
|
||||
return (retval);
|
||||
return retval;
|
||||
|
||||
}
|
||||
else if (maxrank != -(MAXFLOAT))
|
||||
@@ -248,7 +248,7 @@ xfunc_shouldpull(Query *queryInfo,
|
||||
/* and fall through */
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -261,13 +261,13 @@ xfunc_shouldpull(Query *queryInfo,
|
||||
** in the query; it's merely a parent for the new childpath.
|
||||
** We also have to fix up the path costs of the child and parent.
|
||||
**
|
||||
** Now returns a pointer to the new pulled-up CInfo. -- JMH, 11/18/92
|
||||
** Now returns a pointer to the new pulled-up ClauseInfo. -- JMH, 11/18/92
|
||||
*/
|
||||
CInfo
|
||||
ClauseInfo
|
||||
xfunc_pullup(Query *queryInfo,
|
||||
Path childpath,
|
||||
JoinPath parentpath,
|
||||
CInfo cinfo, /* clause to pull up */
|
||||
ClauseInfo cinfo, /* clause to pull up */
|
||||
int whichchild, /* whether child is INNER or OUTER of join */
|
||||
int clausetype) /* whether clause to pull is join or local */
|
||||
{
|
||||
@@ -275,7 +275,7 @@ xfunc_pullup(Query *queryInfo,
|
||||
RelOptInfo newrel;
|
||||
Cost pulled_selec;
|
||||
Cost cost;
|
||||
CInfo newinfo;
|
||||
ClauseInfo newinfo;
|
||||
|
||||
/* remove clause from childpath */
|
||||
newkid = (Path) copyObject((Node) childpath);
|
||||
@@ -321,7 +321,7 @@ xfunc_pullup(Query *queryInfo,
|
||||
* * We copy the cinfo, since it may appear in other plans, and we're
|
||||
* going * to munge it. -- JMH, 7/22/92
|
||||
*/
|
||||
newinfo = (CInfo) copyObject((Node) cinfo);
|
||||
newinfo = (ClauseInfo) copyObject((Node) cinfo);
|
||||
|
||||
/*
|
||||
* * Fix all vars in the clause * to point to the right varno and
|
||||
@@ -346,7 +346,7 @@ xfunc_pullup(Query *queryInfo,
|
||||
cost = xfunc_total_path_cost(parentpath);
|
||||
set_path_cost(parentpath, cost);
|
||||
|
||||
return (newinfo);
|
||||
return newinfo;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -360,10 +360,10 @@ xfunc_rank(Query *queryInfo, LispValue clause)
|
||||
|
||||
if (cost == 0)
|
||||
if (selec > 1)
|
||||
return (MAXFLOAT);
|
||||
return MAXFLOAT;
|
||||
else
|
||||
return (-(MAXFLOAT));
|
||||
return ((selec - 1) / cost);
|
||||
return -(MAXFLOAT);
|
||||
return (selec - 1) / cost;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -385,7 +385,7 @@ LispValue clause;
|
||||
cost /= card;
|
||||
}
|
||||
|
||||
return (cost);
|
||||
return cost;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -414,7 +414,7 @@ xfunc_join_expense(Query *queryInfo, JoinPath path, int whichchild)
|
||||
if (card)
|
||||
cost /= card;
|
||||
|
||||
return (cost);
|
||||
return cost;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -429,13 +429,13 @@ xfunc_local_expense(LispValue clause)
|
||||
|
||||
/* First handle the base case */
|
||||
if (IsA(clause, Const) ||IsA(clause, Var) ||IsA(clause, Param))
|
||||
return (0);
|
||||
return 0;
|
||||
/* now other stuff */
|
||||
else if (IsA(clause, Iter))
|
||||
/* Too low. Should multiply by the expected number of iterations. */
|
||||
return (xfunc_local_expense(get_iterexpr((Iter) clause)));
|
||||
return xfunc_local_expense(get_iterexpr((Iter) clause));
|
||||
else if (IsA(clause, ArrayRef))
|
||||
return (xfunc_local_expense(get_refexpr((ArrayRef) clause)));
|
||||
return xfunc_local_expense(get_refexpr((ArrayRef) clause));
|
||||
else if (fast_is_clause(clause))
|
||||
return (xfunc_func_expense((LispValue) get_op(clause),
|
||||
(LispValue) get_opargs(clause)));
|
||||
@@ -443,19 +443,19 @@ xfunc_local_expense(LispValue clause)
|
||||
return (xfunc_func_expense((LispValue) get_function(clause),
|
||||
(LispValue) get_funcargs(clause)));
|
||||
else if (fast_not_clause(clause))
|
||||
return (xfunc_local_expense(lsecond(clause)));
|
||||
return xfunc_local_expense(lsecond(clause));
|
||||
else if (fast_or_clause(clause) || fast_and_clause(clause))
|
||||
{
|
||||
/* find cost of evaluating each disjunct */
|
||||
for (tmpclause = lnext(clause); tmpclause != LispNil;
|
||||
tmpclause = lnext(tmpclause))
|
||||
cost += xfunc_local_expense(lfirst(tmpclause));
|
||||
return (cost);
|
||||
return cost;
|
||||
}
|
||||
else
|
||||
{
|
||||
elog(ERROR, "Clause node of undetermined type");
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,7 +545,7 @@ xfunc_func_expense(LispValue node, LispValue args)
|
||||
*/
|
||||
foreach(tmpplan, planlist)
|
||||
cost += get_cost((Plan) lfirst(tmpplan));
|
||||
return (cost);
|
||||
return cost;
|
||||
}
|
||||
else
|
||||
{ /* it's a C function */
|
||||
@@ -593,7 +593,7 @@ xfunc_width(LispValue clause)
|
||||
{
|
||||
Relation rd; /* Relation Descriptor */
|
||||
HeapTuple tupl; /* structure to hold a cached tuple */
|
||||
TypeTupleForm type; /* structure to hold a type tuple */
|
||||
Form_pg_type type; /* structure to hold a type tuple */
|
||||
int retval = 0;
|
||||
|
||||
if (IsA(clause, Const))
|
||||
@@ -617,7 +617,7 @@ xfunc_width(LispValue clause)
|
||||
if (!HeapTupleIsValid(tupl))
|
||||
elog(ERROR, "Cache lookup failed for type %d",
|
||||
get_vartype((Var) clause));
|
||||
type = (TypeTupleForm) GETSTRUCT(tupl);
|
||||
type = (Form_pg_type) GETSTRUCT(tupl);
|
||||
if (get_varattno((Var) clause) == 0)
|
||||
{
|
||||
/* clause is a tuple. Get its width */
|
||||
@@ -682,7 +682,7 @@ xfunc_width(LispValue clause)
|
||||
elog(ERROR, "Cache lookup failed for procedure %d",
|
||||
get_opno((Oper) get_op(clause)));
|
||||
return (xfunc_func_width
|
||||
((RegProcedure) (((OperatorTupleForm) (GETSTRUCT(tupl)))->oprcode),
|
||||
((RegProcedure) (((Form_pg_operator) (GETSTRUCT(tupl)))->oprcode),
|
||||
(LispValue) get_opargs(clause)));
|
||||
}
|
||||
else if (fast_is_funcclause(clause))
|
||||
@@ -711,13 +711,13 @@ xfunc_width(LispValue clause)
|
||||
else
|
||||
{
|
||||
elog(ERROR, "Clause node of undetermined type");
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
exit:
|
||||
if (retval == -1)
|
||||
retval = VARLEN_DEFAULT;
|
||||
return (retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -748,7 +748,7 @@ xfunc_card_unreferenced(Query *queryInfo,
|
||||
referenced = xfunc_find_references(clause);
|
||||
unreferenced = set_difference(allrelids, referenced);
|
||||
|
||||
return (xfunc_card_product(unreferenced));
|
||||
return xfunc_card_product(unreferenced);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -774,10 +774,10 @@ xfunc_card_product(Query *queryInfo, Relid relids)
|
||||
/* factor in the selectivity of all zero-cost clauses */
|
||||
foreach(cinfonode, get_clauseinfo(currel))
|
||||
{
|
||||
if (!xfunc_expense(queryInfo, get_clause((CInfo) lfirst(cinfonode))))
|
||||
if (!xfunc_expense(queryInfo, get_clause((ClauseInfo) lfirst(cinfonode))))
|
||||
tuples *=
|
||||
compute_clause_selec(queryInfo,
|
||||
get_clause((CInfo) lfirst(cinfonode)),
|
||||
get_clause((ClauseInfo) lfirst(cinfonode)),
|
||||
LispNil);
|
||||
}
|
||||
|
||||
@@ -789,7 +789,7 @@ xfunc_card_product(Query *queryInfo, Relid relids)
|
||||
}
|
||||
if (retval == 0)
|
||||
retval = 1; /* saves caller from dividing by zero */
|
||||
return (retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@@ -805,9 +805,9 @@ xfunc_find_references(LispValue clause)
|
||||
|
||||
/* Base cases */
|
||||
if (IsA(clause, Var))
|
||||
return (lispCons(lfirst(get_varid((Var) clause)), LispNil));
|
||||
return lispCons(lfirst(get_varid((Var) clause)), LispNil);
|
||||
else if (IsA(clause, Const) ||IsA(clause, Param))
|
||||
return ((List) LispNil);
|
||||
return (List) LispNil;
|
||||
|
||||
/* recursion */
|
||||
else if (IsA(clause, Iter))
|
||||
@@ -816,16 +816,16 @@ xfunc_find_references(LispValue clause)
|
||||
* Too low. Should multiply by the expected number of iterations.
|
||||
* maybe
|
||||
*/
|
||||
return (xfunc_find_references(get_iterexpr((Iter) clause)));
|
||||
return xfunc_find_references(get_iterexpr((Iter) clause));
|
||||
else if (IsA(clause, ArrayRef))
|
||||
return (xfunc_find_references(get_refexpr((ArrayRef) clause)));
|
||||
return xfunc_find_references(get_refexpr((ArrayRef) clause));
|
||||
else if (fast_is_clause(clause))
|
||||
{
|
||||
/* string together result of all operands of Oper */
|
||||
for (tmpclause = (LispValue) get_opargs(clause); tmpclause != LispNil;
|
||||
tmpclause = lnext(tmpclause))
|
||||
retval = nconc(retval, xfunc_find_references(lfirst(tmpclause)));
|
||||
return (retval);
|
||||
return retval;
|
||||
}
|
||||
else if (fast_is_funcclause(clause))
|
||||
{
|
||||
@@ -834,22 +834,22 @@ xfunc_find_references(LispValue clause)
|
||||
tmpclause != LispNil;
|
||||
tmpclause = lnext(tmpclause))
|
||||
retval = nconc(retval, xfunc_find_references(lfirst(tmpclause)));
|
||||
return (retval);
|
||||
return retval;
|
||||
}
|
||||
else if (fast_not_clause(clause))
|
||||
return (xfunc_find_references(lsecond(clause)));
|
||||
return xfunc_find_references(lsecond(clause));
|
||||
else if (fast_or_clause(clause) || fast_and_clause(clause))
|
||||
{
|
||||
/* string together result of all operands of OR */
|
||||
for (tmpclause = lnext(clause); tmpclause != LispNil;
|
||||
tmpclause = lnext(tmpclause))
|
||||
retval = nconc(retval, xfunc_find_references(lfirst(tmpclause)));
|
||||
return (retval);
|
||||
return retval;
|
||||
}
|
||||
else
|
||||
{
|
||||
elog(ERROR, "Clause node of undetermined type");
|
||||
return ((List) LispNil);
|
||||
return (List) LispNil;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -863,7 +863,7 @@ LispValue
|
||||
xfunc_primary_join(JoinPath pathnode)
|
||||
{
|
||||
LispValue joinclauselist = get_pathclauseinfo(pathnode);
|
||||
CInfo mincinfo;
|
||||
ClauseInfo mincinfo;
|
||||
LispValue tmplist;
|
||||
LispValue minclause = LispNil;
|
||||
Cost minrank,
|
||||
@@ -882,7 +882,7 @@ xfunc_primary_join(JoinPath pathnode)
|
||||
minrank = tmprank;
|
||||
minclause = lfirst(tmplist);
|
||||
}
|
||||
return (minclause);
|
||||
return minclause;
|
||||
}
|
||||
else if (IsA(pathnode, HashPath))
|
||||
{
|
||||
@@ -897,24 +897,24 @@ xfunc_primary_join(JoinPath pathnode)
|
||||
minrank = tmprank;
|
||||
minclause = lfirst(tmplist);
|
||||
}
|
||||
return (minclause);
|
||||
return minclause;
|
||||
}
|
||||
|
||||
/* if we drop through, it's nested loop join */
|
||||
if (joinclauselist == LispNil)
|
||||
return (LispNil);
|
||||
return LispNil;
|
||||
|
||||
for (tmplist = joinclauselist, mincinfo = (CInfo) lfirst(joinclauselist),
|
||||
minrank = xfunc_rank(get_clause((CInfo) lfirst(tmplist)));
|
||||
for (tmplist = joinclauselist, mincinfo = (ClauseInfo) lfirst(joinclauselist),
|
||||
minrank = xfunc_rank(get_clause((ClauseInfo) lfirst(tmplist)));
|
||||
tmplist != LispNil;
|
||||
tmplist = lnext(tmplist))
|
||||
if ((tmprank = xfunc_rank(get_clause((CInfo) lfirst(tmplist))))
|
||||
if ((tmprank = xfunc_rank(get_clause((ClauseInfo) lfirst(tmplist))))
|
||||
< minrank)
|
||||
{
|
||||
minrank = tmprank;
|
||||
mincinfo = (CInfo) lfirst(tmplist);
|
||||
mincinfo = (ClauseInfo) lfirst(tmplist);
|
||||
}
|
||||
return ((LispValue) get_clause(mincinfo));
|
||||
return (LispValue) get_clause(mincinfo);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -942,10 +942,10 @@ xfunc_get_path_cost(Query *queryInfo, Path pathnode)
|
||||
tmplist != LispNil;
|
||||
tmplist = lnext(tmplist))
|
||||
{
|
||||
cost += (Cost) (xfunc_local_expense(get_clause((CInfo) lfirst(tmplist)))
|
||||
cost += (Cost) (xfunc_local_expense(get_clause((ClauseInfo) lfirst(tmplist)))
|
||||
* (Cost) get_tuples(get_parent(pathnode)) * selec);
|
||||
selec *= compute_clause_selec(queryInfo,
|
||||
get_clause((CInfo) lfirst(tmplist)),
|
||||
get_clause((ClauseInfo) lfirst(tmplist)),
|
||||
LispNil);
|
||||
}
|
||||
|
||||
@@ -963,10 +963,10 @@ xfunc_get_path_cost(Query *queryInfo, Path pathnode)
|
||||
tmplist != LispNil;
|
||||
tmplist = lnext(tmplist))
|
||||
{
|
||||
cost += (Cost) (xfunc_local_expense(get_clause((CInfo) lfirst(tmplist)))
|
||||
cost += (Cost) (xfunc_local_expense(get_clause((ClauseInfo) lfirst(tmplist)))
|
||||
* (Cost) get_tuples(get_parent(pathnode)) * selec);
|
||||
selec *= compute_clause_selec(queryInfo,
|
||||
get_clause((CInfo) lfirst(tmplist)),
|
||||
get_clause((ClauseInfo) lfirst(tmplist)),
|
||||
LispNil);
|
||||
}
|
||||
}
|
||||
@@ -1005,7 +1005,7 @@ xfunc_get_path_cost(Query *queryInfo, Path pathnode)
|
||||
}
|
||||
}
|
||||
Assert(cost >= 0);
|
||||
return (cost);
|
||||
return cost;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1037,7 +1037,7 @@ xfunc_total_path_cost(JoinPath pathnode)
|
||||
get_width(get_parent((Path) get_innerjoinpath
|
||||
(mrgnode))));
|
||||
Assert(cost >= 0);
|
||||
return (cost);
|
||||
return cost;
|
||||
}
|
||||
else if (IsA(pathnode, HashPath))
|
||||
{
|
||||
@@ -1056,7 +1056,7 @@ xfunc_total_path_cost(JoinPath pathnode)
|
||||
get_width(get_parent((Path) get_innerjoinpath
|
||||
(hashnode))));
|
||||
Assert(cost >= 0);
|
||||
return (cost);
|
||||
return cost;
|
||||
}
|
||||
else
|
||||
/* Nested Loop Join */
|
||||
@@ -1071,7 +1071,7 @@ xfunc_total_path_cost(JoinPath pathnode)
|
||||
(pathnode))),
|
||||
IsA(get_innerjoinpath(pathnode), IndexPath));
|
||||
Assert(cost >= 0);
|
||||
return (cost);
|
||||
return cost;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1105,7 +1105,7 @@ xfunc_expense_per_tuple(JoinPath joinnode, int whichchild)
|
||||
if (IsA(joinnode, HashPath))
|
||||
{
|
||||
if (whichchild == INNER)
|
||||
return ((1 + _CPU_PAGE_WEIGHT_) * outers_per_page / NBuffers);
|
||||
return (1 + _CPU_PAGE_WEIGHT_) * outers_per_page / NBuffers;
|
||||
else
|
||||
return (((1 + _CPU_PAGE_WEIGHT_) * outers_per_page / NBuffers)
|
||||
+ _CPU_PAGE_WEIGHT_
|
||||
@@ -1125,7 +1125,7 @@ xfunc_expense_per_tuple(JoinPath joinnode, int whichchild)
|
||||
/* nestloop */
|
||||
{
|
||||
Assert(IsA(joinnode, JoinPath));
|
||||
return (_CPU_PAGE_WEIGHT_);
|
||||
return _CPU_PAGE_WEIGHT_;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1189,19 +1189,19 @@ xfunc_fixvars(LispValue clause, /* clause being pulled up */
|
||||
|
||||
|
||||
/*
|
||||
** Comparison function for lisp_qsort() on a list of CInfo's.
|
||||
** arg1 and arg2 should really be of type (CInfo *).
|
||||
** Comparison function for lisp_qsort() on a list of ClauseInfo's.
|
||||
** arg1 and arg2 should really be of type (ClauseInfo *).
|
||||
*/
|
||||
int
|
||||
xfunc_cinfo_compare(void *arg1, void *arg2)
|
||||
{
|
||||
CInfo info1 = *(CInfo *) arg1;
|
||||
CInfo info2 = *(CInfo *) arg2;
|
||||
ClauseInfo info1 = *(ClauseInfo *) arg1;
|
||||
ClauseInfo info2 = *(ClauseInfo *) arg2;
|
||||
|
||||
LispValue clause1 = (LispValue) get_clause(info1),
|
||||
clause2 = (LispValue) get_clause(info2);
|
||||
|
||||
return (xfunc_clause_compare((void *) &clause1, (void *) &clause2));
|
||||
return xfunc_clause_compare((void *) &clause1, (void *) &clause2);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1221,11 +1221,11 @@ xfunc_clause_compare(void *arg1, void *arg2)
|
||||
rank2 = xfunc_rank(clause2);
|
||||
|
||||
if (rank1 < rank2)
|
||||
return (-1);
|
||||
return -1;
|
||||
else if (rank1 == rank2)
|
||||
return (0);
|
||||
return 0;
|
||||
else
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1285,11 +1285,11 @@ xfunc_disjunct_compare(Query *queryInfo, void *arg1, void *arg2)
|
||||
rank2 = cost2 / selec2;
|
||||
|
||||
if (rank1 < rank2)
|
||||
return (-1);
|
||||
return -1;
|
||||
else if (rank1 == rank2)
|
||||
return (0);
|
||||
return 0;
|
||||
else
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ------------------------ UTILITY FUNCTIONS ------------------------------- */
|
||||
@@ -1303,7 +1303,7 @@ xfunc_func_width(RegProcedure funcid, LispValue args)
|
||||
Relation rd; /* Relation Descriptor */
|
||||
HeapTuple tupl; /* structure to hold a cached tuple */
|
||||
Form_pg_proc proc; /* structure to hold the pg_proc tuple */
|
||||
TypeTupleForm type; /* structure to hold the pg_type tuple */
|
||||
Form_pg_type type; /* structure to hold the pg_type tuple */
|
||||
LispValue tmpclause;
|
||||
int retval;
|
||||
|
||||
@@ -1332,7 +1332,7 @@ xfunc_func_width(RegProcedure funcid, LispValue args)
|
||||
0, 0, 0);
|
||||
if (!HeapTupleIsValid(tupl))
|
||||
elog(ERROR, "Cache lookup failed for type %d", proc->prorettype);
|
||||
type = (TypeTupleForm) GETSTRUCT(tupl);
|
||||
type = (Form_pg_type) GETSTRUCT(tupl);
|
||||
/* if the type length is known, return that */
|
||||
if (type->typlen != -1)
|
||||
{
|
||||
@@ -1352,7 +1352,7 @@ xfunc_func_width(RegProcedure funcid, LispValue args)
|
||||
}
|
||||
}
|
||||
exit:
|
||||
return (retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1364,7 +1364,7 @@ xfunc_tuple_width(Relation rd)
|
||||
{
|
||||
int i;
|
||||
int retval = 0;
|
||||
TupleDesc tdesc = RelationGetTupleDescriptor(rd);
|
||||
TupleDesc tdesc = RelationGetDescr(rd);
|
||||
|
||||
for (i = 0; i < tdesc->natts; i++)
|
||||
{
|
||||
@@ -1374,7 +1374,7 @@ xfunc_tuple_width(Relation rd)
|
||||
retval += VARLEN_DEFAULT;
|
||||
}
|
||||
|
||||
return (retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1387,11 +1387,11 @@ xfunc_num_join_clauses(JoinPath path)
|
||||
int num = length(get_pathclauseinfo(path));
|
||||
|
||||
if (IsA(path, MergePath))
|
||||
return (num + length(get_path_mergeclauses((MergePath) path)));
|
||||
return num + length(get_path_mergeclauses((MergePath) path));
|
||||
else if (IsA(path, HashPath))
|
||||
return (num + length(get_path_hashclauses((HashPath) path)));
|
||||
return num + length(get_path_hashclauses((HashPath) path));
|
||||
else
|
||||
return (num);
|
||||
return num;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1414,7 +1414,7 @@ xfunc_LispRemove(LispValue foo, List bar)
|
||||
if (!sanity)
|
||||
elog(ERROR, "xfunc_LispRemove: didn't find a match!");
|
||||
|
||||
return (result);
|
||||
return result;
|
||||
}
|
||||
|
||||
#define Node_Copy(a, b, c, d) \
|
||||
|
||||
Reference in New Issue
Block a user