1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-25 01:02:05 +03:00

Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting.

This commit is contained in:
Bruce Momjian
1997-09-08 02:41:22 +00:00
parent a90f12fd9d
commit 319dbfa736
632 changed files with 28301 additions and 28220 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.11 1997/09/07 04:43:27 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.12 1997/09/08 02:24:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -34,17 +34,17 @@
#include "optimizer/geqo.h"
#ifdef GEQO
bool _use_geqo_ = true;
bool _use_geqo_ = true;
#else
bool _use_geqo_ = false;
bool _use_geqo_ = false;
#endif
int32 _use_geqo_rels_ = GEQO_RELS;
int32 _use_geqo_rels_ = GEQO_RELS;
static void find_rel_paths(Query * root, List * rels);
static List *find_join_paths(Query * root, List * outer_rels, int levels_left);
static void find_rel_paths(Query * root, List * rels);
static List *find_join_paths(Query * root, List * outer_rels, int levels_left);
/*
* find-paths--
@ -53,10 +53,10 @@ static List *find_join_paths(Query * root, List * outer_rels, int levels_left
*
* 'rels' is the list of single relation entries appearing in the query
*/
List *
List *
find_paths(Query * root, List * rels)
{
int levels_left;
int levels_left;
/*
* Set the number of join (not nesting) levels yet to be processed.
@ -104,15 +104,15 @@ find_paths(Query * root, List * rels)
static void
find_rel_paths(Query * root, List * rels)
{
List *temp;
Rel *rel;
List *lastpath;
List *temp;
Rel *rel;
List *lastpath;
foreach(temp, rels)
{
List *sequential_scan_list;
List *rel_index_scan_list;
List *or_index_scan_list;
List *sequential_scan_list;
List *rel_index_scan_list;
List *or_index_scan_list;
rel = (Rel *) lfirst(temp);
sequential_scan_list = lcons(create_seqscan_path(rel),
@ -171,12 +171,12 @@ find_rel_paths(Query * root, List * rels)
* Returns the final level of join relations, i.e., the relation that is
* the result of joining all the original relations togehter.
*/
static List *
static List *
find_join_paths(Query * root, List * outer_rels, int levels_left)
{
List *x;
List *new_rels;
Rel *rel;
List *x;
List *new_rels;
Rel *rel;
/*******************************************
* genetic query optimizer entry point *
@ -283,12 +283,12 @@ find_join_paths(Query * root, List * outer_rels, int levels_left)
static void
print_joinclauses(Query * root, List * clauses)
{
List *l;
extern void print_expr(Node * expr, List * rtable); /* in print.c */
List *l;
extern void print_expr(Node * expr, List * rtable); /* in print.c */
foreach(l, clauses)
{
CInfo *c = lfirst(l);
CInfo *c = lfirst(l);
print_expr((Node *) c->clause, root->rtable);
if (lnext(l))
@ -299,88 +299,88 @@ print_joinclauses(Query * root, List * clauses)
static void
print_path(Query * root, Path * path, int indent)
{
char *ptype = NULL;
JoinPath *jp;
bool join = false;
int i;
char *ptype = NULL;
JoinPath *jp;
bool join = false;
int i;
for (i = 0; i < indent; i++)
printf("\t");
switch (nodeTag(path))
{
case T_Path:
ptype = "SeqScan";
join = false;
break;
case T_IndexPath:
ptype = "IdxScan";
join = false;
break;
case T_JoinPath:
ptype = "Nestloop";
join = true;
break;
case T_MergePath:
ptype = "MergeJoin";
join = true;
break;
case T_HashPath:
ptype = "HashJoin";
join = true;
break;
default:
break;
case T_Path:
ptype = "SeqScan";
join = false;
break;
case T_IndexPath:
ptype = "IdxScan";
join = false;
break;
case T_JoinPath:
ptype = "Nestloop";
join = true;
break;
case T_MergePath:
ptype = "MergeJoin";
join = true;
break;
case T_HashPath:
ptype = "HashJoin";
join = true;
break;
default:
break;
}
if (join)
{
int size = path->parent->size;
int size = path->parent->size;
jp = (JoinPath *) path;
printf("%s size=%d cost=%f\n", ptype, size, path->path_cost);
switch (nodeTag(path))
{
case T_MergePath:
case T_HashPath:
for (i = 0; i < indent + 1; i++)
printf("\t");
printf(" clauses=(");
print_joinclauses(root,
((JoinPath *) path)->pathclauseinfo);
printf(")\n");
case T_MergePath:
case T_HashPath:
for (i = 0; i < indent + 1; i++)
printf("\t");
printf(" clauses=(");
print_joinclauses(root,
((JoinPath *) path)->pathclauseinfo);
printf(")\n");
if (nodeTag(path) == T_MergePath)
{
MergePath *mp = (MergePath *) path;
if (mp->outersortkeys || mp->innersortkeys)
if (nodeTag(path) == T_MergePath)
{
for (i = 0; i < indent + 1; i++)
printf("\t");
printf(" sortouter=%d sortinner=%d\n",
((mp->outersortkeys) ? 1 : 0),
((mp->innersortkeys) ? 1 : 0));
MergePath *mp = (MergePath *) path;
if (mp->outersortkeys || mp->innersortkeys)
{
for (i = 0; i < indent + 1; i++)
printf("\t");
printf(" sortouter=%d sortinner=%d\n",
((mp->outersortkeys) ? 1 : 0),
((mp->innersortkeys) ? 1 : 0));
}
}
}
break;
default:
break;
break;
default:
break;
}
print_path(root, jp->outerjoinpath, indent + 1);
print_path(root, jp->innerjoinpath, indent + 1);
}
else
{
int size = path->parent->size;
int relid = lfirsti(path->parent->relids);
int size = path->parent->size;
int relid = lfirsti(path->parent->relids);
printf("%s(%d) size=%d cost=%f",
ptype, relid, size, path->path_cost);
if (nodeTag(path) == T_IndexPath)
{
List *k,
*l;
List *k,
*l;
printf(" keys=");
foreach(k, path->keys)
@ -388,7 +388,7 @@ print_path(Query * root, Path * path, int indent)
printf("(");
foreach(l, lfirst(k))
{
Var *var = lfirst(l);
Var *var = lfirst(l);
printf("%d.%d", var->varnoold, var->varoattno);
if (lnext(l))
@ -406,7 +406,7 @@ print_path(Query * root, Path * path, int indent)
static void
debug_print_rel(Query * root, Rel * rel)
{
List *l;
List *l;
printf("(");
foreach(l, rel->relids)

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.2 1997/09/07 04:43:31 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.3 1997/09/08 02:24:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -31,7 +31,7 @@
#include "utils/elog.h"
#include "utils/lsyscache.h"
static Cost compute_selec(Query * root, List * clauses, List * or_selectivities);
static Cost compute_selec(Query * root, List * clauses, List * or_selectivities);
/****************************************************************************
* ROUTINES TO SET CLAUSE SELECTIVITIES
@ -49,9 +49,9 @@ static Cost compute_selec(Query * root, List * clauses, List * or_selectivities
void
set_clause_selectivities(List * clauseinfo_list, Cost new_selectivity)
{
List *temp;
CInfo *clausenode;
Cost cost_clause;
List *temp;
CInfo *clausenode;
Cost cost_clause;
foreach(temp, clauseinfo_list)
{
@ -73,12 +73,12 @@ set_clause_selectivities(List * clauseinfo_list, Cost new_selectivity)
Cost
product_selec(List * clauseinfo_list)
{
Cost result = 1.0;
Cost result = 1.0;
if (clauseinfo_list != NIL)
{
List *xclausenode = NIL;
Cost temp;
List *xclausenode = NIL;
Cost temp;
foreach(xclausenode, clauseinfo_list)
{
@ -101,8 +101,8 @@ product_selec(List * clauseinfo_list)
void
set_rest_relselec(Query * root, List * rel_list)
{
Rel *rel;
List *x;
Rel *rel;
List *x;
foreach(x, rel_list)
{
@ -122,9 +122,9 @@ set_rest_relselec(Query * root, List * rel_list)
void
set_rest_selec(Query * root, List * clauseinfo_list)
{
List *temp = NIL;
CInfo *clausenode = (CInfo *) NULL;
Cost cost_clause;
List *temp = NIL;
CInfo *clausenode = (CInfo *) NULL;
Cost cost_clause;
foreach(temp, clauseinfo_list)
{
@ -222,11 +222,11 @@ compute_clause_selec(Query * root, Node * clause, List * or_selectivities)
* Returns the clause selectivity as a flonum.
*
*/
static Cost
static Cost
compute_selec(Query * root, List * clauses, List * or_selectivities)
{
Cost s1 = 0;
List *clause = lfirst(clauses);
Cost s1 = 0;
List *clause = lfirst(clauses);
if (clauses == NULL)
{
@ -243,8 +243,8 @@ compute_selec(Query * root, List * clauses, List * or_selectivities)
}
else if (IsA(clause, Var))
{
Oid relid = getrelid(((Var *) clause)->varno,
root->rtable);
Oid relid = getrelid(((Var *) clause)->varno,
root->rtable);
/*
* we have a bool Var. This is exactly equivalent to the clause:
@ -264,7 +264,7 @@ compute_selec(Query * root, List * clauses, List * or_selectivities)
else if (or_selectivities)
{
/* If s1 has already been assigned by an index, use that value. */
List *this_sel = lfirst(or_selectivities);
List *this_sel = lfirst(or_selectivities);
s1 = floatVal(this_sel);
}
@ -288,13 +288,13 @@ compute_selec(Query * root, List * clauses, List * or_selectivities)
* clause selectivity will be based on the operator selectivity
* and operand values.
*/
Oid opno = ((Oper *) ((Expr *) clause)->oper)->opno;
RegProcedure oprrest = get_oprrest(opno);
Oid relid;
int relidx;
AttrNumber attno;
Datum constval;
int flag;
Oid opno = ((Oper *) ((Expr *) clause)->oper)->opno;
RegProcedure oprrest = get_oprrest(opno);
Oid relid;
int relidx;
AttrNumber attno;
Datum constval;
int flag;
get_relattval((Node *) clause, &relidx, &attno, &constval, &flag);
relid = getrelid(relidx, root->rtable);
@ -332,12 +332,12 @@ compute_selec(Query * root, List * clauses, List * or_selectivities)
* be based on the relations to be scanned and the attributes they
* are to be joined on.
*/
Oid opno = ((Oper *) ((Expr *) clause)->oper)->opno;
RegProcedure oprjoin = get_oprjoin(opno);
int relid1,
relid2;
AttrNumber attno1,
attno2;
Oid opno = ((Oper *) ((Expr *) clause)->oper)->opno;
RegProcedure oprjoin = get_oprjoin(opno);
int relid1,
relid2;
AttrNumber attno1,
attno2;
get_rels_atts((Node *) clause, &relid1, &attno1, &relid2, &attno2);
relid1 = getrelid(relid1, root->rtable);
@ -372,7 +372,7 @@ compute_selec(Query * root, List * clauses, List * or_selectivities)
{
/* Compute selectivity of the 'or'ed subclauses. */
/* Added check for taking lnext(NIL). -- JMH 3/9/92 */
Cost s2;
Cost s2;
if (or_selectivities != NIL)
s2 = compute_selec(root, lnext(clauses), lnext(or_selectivities));

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.17 1997/09/07 04:43:33 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.18 1997/09/08 02:24:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -37,24 +37,24 @@
#include "storage/bufmgr.h" /* for BLCKSZ */
extern int NBuffers;
extern int NBuffers;
static int compute_attribute_width(TargetEntry * tlistentry);
static double base_log(double x, double b);
static int compute_targetlist_width(List * targetlist);
static int compute_attribute_width(TargetEntry * tlistentry);
static double base_log(double x, double b);
static int compute_targetlist_width(List * targetlist);
int _disable_cost_ = 30000000;
int _disable_cost_ = 30000000;
bool _enable_seqscan_ = true;
bool _enable_indexscan_ = true;
bool _enable_sort_ = true;
bool _enable_hash_ = true;
bool _enable_nestloop_ = true;
bool _enable_mergesort_ = true;
bool _enable_hashjoin_ = true;
bool _enable_seqscan_ = true;
bool _enable_indexscan_ = true;
bool _enable_sort_ = true;
bool _enable_hash_ = true;
bool _enable_nestloop_ = true;
bool _enable_mergesort_ = true;
bool _enable_hashjoin_ = true;
Cost _cpu_page_wight_ = _CPU_PAGE_WEIGHT_;
Cost _cpu_index_page_wight_ = _CPU_INDEX_PAGE_WEIGHT_;
Cost _cpu_page_wight_ = _CPU_PAGE_WEIGHT_;
Cost _cpu_index_page_wight_ = _CPU_INDEX_PAGE_WEIGHT_;
/*
* cost_seqscan--
@ -79,7 +79,7 @@ Cost _cpu_index_page_wight_ = _CPU_INDEX_PAGE_WEIGHT_;
Cost
cost_seqscan(int relid, int relpages, int reltuples)
{
Cost temp = 0;
Cost temp = 0;
if (!_enable_seqscan_)
temp += _disable_cost_;
@ -131,8 +131,8 @@ cost_index(Oid indexid,
int indextuples,
bool is_injoin)
{
Cost temp;
double temp2;
Cost temp;
double temp2;
temp = (Cost) 0;
@ -179,10 +179,10 @@ cost_index(Oid indexid,
Cost
cost_sort(List * keys, int tuples, int width, bool noread)
{
Cost temp = 0;
int npages = page_size(tuples, width);
Cost pages = (Cost) npages;
Cost numTuples = tuples;
Cost temp = 0;
int npages = page_size(tuples, width);
Cost pages = (Cost) npages;
Cost numTuples = tuples;
if (!_enable_sort_)
temp += _disable_cost_;
@ -220,7 +220,7 @@ cost_sort(List * keys, int tuples, int width, bool noread)
Cost
cost_result(int tuples, int width)
{
Cost temp = 0;
Cost temp = 0;
temp = temp + page_size(tuples, width);
temp = temp + _cpu_page_wight_ * tuples;
@ -250,7 +250,7 @@ cost_nestloop(Cost outercost,
int outerpages,
bool is_indexjoin)
{
Cost temp = 0;
Cost temp = 0;
if (!_enable_nestloop_)
temp += _disable_cost_;
@ -285,7 +285,7 @@ cost_mergesort(Cost outercost,
int outerwidth,
int innerwidth)
{
Cost temp = 0;
Cost temp = 0;
if (!_enable_mergesort_)
temp += _disable_cost_;
@ -323,10 +323,10 @@ cost_hashjoin(Cost outercost,
int outerwidth,
int innerwidth)
{
Cost temp = 0;
int outerpages = page_size(outersize, outerwidth);
int innerpages = page_size(innersize, innerwidth);
int nrun = ceil((double) outerpages / (double) NBuffers);
Cost temp = 0;
int outerpages = page_size(outersize, outerwidth);
int innerpages = page_size(innersize, innerwidth);
int nrun = ceil((double) outerpages / (double) NBuffers);
if (outerpages < innerpages)
return _disable_cost_;
@ -365,8 +365,8 @@ cost_hashjoin(Cost outercost,
int
compute_rel_size(Rel * rel)
{
Cost temp;
int temp1;
Cost temp;
int temp1;
temp = rel->tuples * product_selec(rel->clauseinfo);
Assert(temp >= 0);
@ -404,8 +404,8 @@ compute_rel_width(Rel * rel)
static int
compute_targetlist_width(List * targetlist)
{
List *temp_tl;
int tuple_width = 0;
List *temp_tl;
int tuple_width = 0;
foreach(temp_tl, targetlist)
{
@ -427,7 +427,7 @@ compute_targetlist_width(List * targetlist)
static int
compute_attribute_width(TargetEntry * tlistentry)
{
int width = get_typlen(tlistentry->resdom->restype);
int width = get_typlen(tlistentry->resdom->restype);
if (width < 0)
return (_DEFAULT_ATTRIBUTE_WIDTH_);
@ -444,8 +444,8 @@ compute_attribute_width(TargetEntry * tlistentry)
int
compute_joinrel_size(JoinPath * joinpath)
{
Cost temp = 1.0;
int temp1 = 0;
Cost temp = 1.0;
int temp1 = 0;
temp *= ((Path *) joinpath->outerjoinpath)->parent->size;
temp *= ((Path *) joinpath->innerjoinpath)->parent->size;
@ -477,7 +477,7 @@ compute_joinrel_size(JoinPath * joinpath)
int
page_size(int tuples, int width)
{
int temp = 0;
int temp = 0;
temp = ceil((double) (tuples * (width + sizeof(HeapTupleData)))
/ BLCKSZ);

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.2 1997/09/07 04:43:34 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.3 1997/09/08 02:24:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -20,7 +20,7 @@
#include "optimizer/clauses.h"
static HInfo *match_hashop_hashinfo(Oid hashop, List * hashinfo_list);
static HInfo *match_hashop_hashinfo(Oid hashop, List * hashinfo_list);
/*
* group-clauses-by-hashop--
@ -34,14 +34,14 @@ static HInfo *match_hashop_hashinfo(Oid hashop, List * hashinfo_list);
* Returns the new list of hashinfo nodes.
*
*/
List *
List *
group_clauses_by_hashop(List * clauseinfo_list,
int inner_relid)
{
List *hashinfo_list = NIL;
CInfo *clauseinfo = (CInfo *) NULL;
List *i = NIL;
Oid hashjoinop = 0;
List *hashinfo_list = NIL;
CInfo *clauseinfo = (CInfo *) NULL;
List *i = NIL;
Oid hashjoinop = 0;
foreach(i, clauseinfo_list)
{
@ -54,11 +54,11 @@ group_clauses_by_hashop(List * clauseinfo_list,
*/
if (hashjoinop)
{
HInfo *xhashinfo = (HInfo *) NULL;
Expr *clause = clauseinfo->clause;
Var *leftop = get_leftop(clause);
Var *rightop = get_rightop(clause);
JoinKey *keys = (JoinKey *) NULL;
HInfo *xhashinfo = (HInfo *) NULL;
Expr *clause = clauseinfo->clause;
Var *leftop = get_leftop(clause);
Var *rightop = get_rightop(clause);
JoinKey *keys = (JoinKey *) NULL;
xhashinfo =
match_hashop_hashinfo(hashjoinop, hashinfo_list);
@ -108,12 +108,12 @@ group_clauses_by_hashop(List * clauseinfo_list,
* Returns the node if it exists.
*
*/
static HInfo *
static HInfo *
match_hashop_hashinfo(Oid hashop, List * hashinfo_list)
{
Oid key = 0;
HInfo *xhashinfo = (HInfo *) NULL;
List *i = NIL;
Oid key = 0;
HInfo *xhashinfo = (HInfo *) NULL;
List *i = NIL;
foreach(i, hashinfo_list)
{

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.9 1997/09/07 04:43:36 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.10 1997/09/08 02:24:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -52,37 +52,37 @@ match_index_orclauses(Rel * rel, Rel * index, int indexkey,
static bool
match_index_to_operand(int indexkey, Expr * operand,
Rel * rel, Rel * index);
static List *
static List *
match_index_orclause(Rel * rel, Rel * index, int indexkey,
int xclass, List * or_clauses, List * other_matching_indices);
static List *
static List *
group_clauses_by_indexkey(Rel * rel, Rel * index,
int *indexkeys, Oid * classes, List * clauseinfo_list);
static List *
static List *
group_clauses_by_ikey_for_joins(Rel * rel, Rel * index,
int *indexkeys, Oid * classes, List * join_cinfo_list, List * restr_cinfo_list);
static CInfo *
static CInfo *
match_clause_to_indexkey(Rel * rel, Rel * index, int indexkey,
int xclass, CInfo * clauseInfo, bool join);
static bool
pred_test(List * predicate_list, List * clauseinfo_list,
List * joininfo_list);
static bool one_pred_test(Expr * predicate, List * clauseinfo_list);
static bool one_pred_clause_expr_test(Expr * predicate, Node * clause);
static bool one_pred_clause_test(Expr * predicate, Node * clause);
static bool clause_pred_clause_test(Expr * predicate, Node * clause);
static List *
static bool one_pred_test(Expr * predicate, List * clauseinfo_list);
static bool one_pred_clause_expr_test(Expr * predicate, Node * clause);
static bool one_pred_clause_test(Expr * predicate, Node * clause);
static bool clause_pred_clause_test(Expr * predicate, Node * clause);
static List *
indexable_joinclauses(Rel * rel, Rel * index,
List * joininfo_list, List * clauseinfo_list);
static List *
static List *
index_innerjoin(Query * root, Rel * rel,
List * clausegroup_list, Rel * index);
static List *
static List *
create_index_paths(Query * root, Rel * rel, Rel * index,
List * clausegroup_list, bool join);
static List *add_index_paths(List * indexpaths, List * new_indexpaths);
static bool function_index_operand(Expr * funcOpnd, Rel * rel, Rel * index);
static bool SingleAttributeIndex(Rel * index);
static List *add_index_paths(List * indexpaths, List * new_indexpaths);
static bool function_index_operand(Expr * funcOpnd, Rel * rel, Rel * index);
static bool SingleAttributeIndex(Rel * index);
/* If Spyros can use a constant PRS2_BOOL_TYPEID, I can use this */
#define BOOL_TYPEID ((Oid) 16)
@ -113,19 +113,19 @@ static bool SingleAttributeIndex(Rel * index);
* Returns a list of index nodes.
*
*/
List *
List *
find_index_paths(Query * root,
Rel * rel,
List * indices,
List * clauseinfo_list,
List * joininfo_list)
{
List *scanclausegroups = NIL;
List *scanpaths = NIL;
Rel *index = (Rel *) NULL;
List *joinclausegroups = NIL;
List *joinpaths = NIL;
List *retval = NIL;
List *scanclausegroups = NIL;
List *scanpaths = NIL;
Rel *index = (Rel *) NULL;
List *joinclausegroups = NIL;
List *joinpaths = NIL;
List *retval = NIL;
if (indices == NIL)
return (NULL);
@ -193,11 +193,11 @@ find_index_paths(Query * root,
if (joinclausegroups != NIL)
{
List *new_join_paths = create_index_paths(root, rel,
index,
List *new_join_paths = create_index_paths(root, rel,
index,
joinclausegroups,
true);
List *innerjoin_paths = index_innerjoin(root, rel, joinclausegroups, index);
true);
List *innerjoin_paths = index_innerjoin(root, rel, joinclausegroups, index);
rel->innerjoin = nconc(rel->innerjoin, innerjoin_paths);
joinpaths = new_join_paths;
@ -246,8 +246,8 @@ match_index_orclauses(Rel * rel,
int xclass,
List * clauseinfo_list)
{
CInfo *clauseinfo = (CInfo *) NULL;
List *i = NIL;
CInfo *clauseinfo = (CInfo *) NULL;
List *i = NIL;
foreach(i, clauseinfo_list)
{
@ -275,7 +275,7 @@ match_index_orclauses(Rel * rel,
* and the operand on the rhs of a restriction clause. Now check
* for functional indices as well.
*/
static bool
static bool
match_index_to_operand(int indexkey,
Expr * operand,
Rel * rel,
@ -315,7 +315,7 @@ match_index_to_operand(int indexkey,
* 'or-clauses', d,e,f match the second subclause, no indices
* match the third, g,h match the fourth, etc.
*/
static List *
static List *
match_index_orclause(Rel * rel,
Rel * index,
int indexkey,
@ -323,11 +323,11 @@ match_index_orclause(Rel * rel,
List * or_clauses,
List * other_matching_indices)
{
Node *clause = NULL;
List *matched_indices = other_matching_indices;
List *index_list = NIL;
List *clist;
List *ind;
Node *clause = NULL;
List *matched_indices = other_matching_indices;
List *index_list = NIL;
List *clist;
List *ind;
if (!matched_indices)
matched_indices = lcons(NIL, NIL);
@ -397,32 +397,32 @@ match_index_orclause(Rel * rel,
* returned for an index with 2 keys.
*
*/
static List *
static List *
group_clauses_by_indexkey(Rel * rel,
Rel * index,
int *indexkeys,
Oid * classes,
List * clauseinfo_list)
{
List *curCinfo = NIL;
CInfo *matched_clause = (CInfo *) NULL;
List *clausegroup = NIL;
int curIndxKey;
Oid curClass;
List *curCinfo = NIL;
CInfo *matched_clause = (CInfo *) NULL;
List *clausegroup = NIL;
int curIndxKey;
Oid curClass;
if (clauseinfo_list == NIL)
return NIL;
while (!DoneMatchingIndexKeys(indexkeys, index))
{
List *tempgroup = NIL;
List *tempgroup = NIL;
curIndxKey = indexkeys[0];
curClass = classes[0];
foreach(curCinfo, clauseinfo_list)
{
CInfo *temp = (CInfo *) lfirst(curCinfo);
CInfo *temp = (CInfo *) lfirst(curCinfo);
matched_clause = match_clause_to_indexkey(rel,
index,
@ -459,7 +459,7 @@ group_clauses_by_indexkey(Rel * rel,
* - vadim 03/18/97
*
*/
static List *
static List *
group_clauses_by_ikey_for_joins(Rel * rel,
Rel * index,
int *indexkeys,
@ -467,26 +467,26 @@ group_clauses_by_ikey_for_joins(Rel * rel,
List * join_cinfo_list,
List * restr_cinfo_list)
{
List *curCinfo = NIL;
CInfo *matched_clause = (CInfo *) NULL;
List *clausegroup = NIL;
int curIndxKey;
Oid curClass;
bool jfound = false;
List *curCinfo = NIL;
CInfo *matched_clause = (CInfo *) NULL;
List *clausegroup = NIL;
int curIndxKey;
Oid curClass;
bool jfound = false;
if (join_cinfo_list == NIL)
return NIL;
while (!DoneMatchingIndexKeys(indexkeys, index))
{
List *tempgroup = NIL;
List *tempgroup = NIL;
curIndxKey = indexkeys[0];
curClass = classes[0];
foreach(curCinfo, join_cinfo_list)
{
CInfo *temp = (CInfo *) lfirst(curCinfo);
CInfo *temp = (CInfo *) lfirst(curCinfo);
matched_clause = match_clause_to_indexkey(rel,
index,
@ -502,7 +502,7 @@ group_clauses_by_ikey_for_joins(Rel * rel,
}
foreach(curCinfo, restr_cinfo_list)
{
CInfo *temp = (CInfo *) lfirst(curCinfo);
CInfo *temp = (CInfo *) lfirst(curCinfo);
matched_clause = match_clause_to_indexkey(rel,
index,
@ -582,7 +582,7 @@ group_clauses_by_ikey_for_joins(Rel * rel,
* NOTE: returns nil if clause is an or_clause.
*
*/
static CInfo *
static CInfo *
match_clause_to_indexkey(Rel * rel,
Rel * index,
int indexkey,
@ -590,12 +590,12 @@ match_clause_to_indexkey(Rel * rel,
CInfo * clauseInfo,
bool join)
{
Expr *clause = clauseInfo->clause;
Var *leftop,
*rightop;
Oid join_op = InvalidOid;
Oid restrict_op = InvalidOid;
bool isIndexable = false;
Expr *clause = clauseInfo->clause;
Var *leftop,
*rightop;
Oid join_op = InvalidOid;
Oid restrict_op = InvalidOid;
bool isIndexable = false;
if (or_clause((Node *) clause) ||
not_clause((Node *) clause) || single_node((Node *) clause))
@ -719,12 +719,12 @@ match_clause_to_indexkey(Rel * rel,
* succeed whenever possible (assuming the predicate has been
* successfully cnfify()-ed). --Nels, Jan '93
*/
static bool
static bool
pred_test(List * predicate_list, List * clauseinfo_list, List * joininfo_list)
{
List *pred,
*items,
*item;
List *pred,
*items,
*item;
/*
* Note: if Postgres tried to optimize queries by forming equivalence
@ -770,11 +770,11 @@ pred_test(List * predicate_list, List * clauseinfo_list, List * joininfo_list)
* Does the "predicate inclusion test" for one conjunct of a predicate
* expression.
*/
static bool
static bool
one_pred_test(Expr * predicate, List * clauseinfo_list)
{
CInfo *clauseinfo;
List *item;
CInfo *clauseinfo;
List *item;
Assert(predicate != NULL);
foreach(item, clauseinfo_list)
@ -793,11 +793,11 @@ one_pred_test(Expr * predicate, List * clauseinfo_list)
* Does the "predicate inclusion test" for a general restriction-clause
* expression.
*/
static bool
static bool
one_pred_clause_expr_test(Expr * predicate, Node * clause)
{
List *items,
*item;
List *items,
*item;
if (is_opclause(clause))
return one_pred_clause_test(predicate, clause);
@ -840,11 +840,11 @@ one_pred_clause_expr_test(Expr * predicate, Node * clause)
* Does the "predicate inclusion test" for one conjunct of a predicate
* expression for a simple restriction clause.
*/
static bool
static bool
one_pred_clause_test(Expr * predicate, Node * clause)
{
List *items,
*item;
List *items,
*item;
if (is_opclause((Node *) predicate))
return clause_pred_clause_test(predicate, clause);
@ -903,7 +903,7 @@ one_pred_clause_test(Expr * predicate, Node * clause)
* this test should always be considered false.
*/
StrategyNumber BT_implic_table[BTMaxStrategyNumber][BTMaxStrategyNumber] = {
StrategyNumber BT_implic_table[BTMaxStrategyNumber][BTMaxStrategyNumber] = {
{2, 2, 0, 0, 0},
{1, 2, 0, 0, 0},
{1, 2, 3, 4, 5},
@ -922,29 +922,29 @@ StrategyNumber BT_implic_table[BTMaxStrategyNumber][BTMaxStrategyNumber] = {
* Eventually, rtree operators could also be handled by defining an
* appropriate "RT_implic_table" array.
*/
static bool
static bool
clause_pred_clause_test(Expr * predicate, Node * clause)
{
Var *pred_var,
*clause_var;
Const *pred_const,
*clause_const;
Oid pred_op,
clause_op,
test_op;
Oid opclass_id;
StrategyNumber pred_strategy,
clause_strategy,
test_strategy;
Oper *test_oper;
Expr *test_expr;
bool test_result,
isNull;
Relation relation;
HeapScanDesc scan;
HeapTuple tuple;
ScanKeyData entry[3];
Form_pg_amop form;
Var *pred_var,
*clause_var;
Const *pred_const,
*clause_const;
Oid pred_op,
clause_op,
test_op;
Oid opclass_id;
StrategyNumber pred_strategy,
clause_strategy,
test_strategy;
Oper *test_oper;
Expr *test_expr;
bool test_result,
isNull;
Relation relation;
HeapScanDesc scan;
HeapTuple tuple;
ScanKeyData entry[3];
Form_pg_amop form;
pred_var = (Var *) get_leftop(predicate);
pred_const = (Const *) get_rightop(predicate);
@ -1120,14 +1120,14 @@ clause_pred_clause_test(Expr * predicate, Node * clause)
* when a key is in both join & restriction clauses. - vadim 03/18/97
*
*/
static List *
static List *
indexable_joinclauses(Rel * rel, Rel * index,
List * joininfo_list, List * clauseinfo_list)
{
JInfo *joininfo = (JInfo *) NULL;
List *cg_list = NIL;
List *i = NIL;
List *clausegroups = NIL;
JInfo *joininfo = (JInfo *) NULL;
List *cg_list = NIL;
List *i = NIL;
List *clausegroups = NIL;
foreach(i, joininfo_list)
{
@ -1145,7 +1145,7 @@ indexable_joinclauses(Rel * rel, Rel * index,
if (clausegroups != NIL)
{
List *clauses = lfirst(clausegroups);
List *clauses = lfirst(clausegroups);
((CInfo *) lfirst(clauses))->cinfojoinid =
joininfo->otherrels;
@ -1165,15 +1165,15 @@ indexable_joinclauses(Rel * rel, Rel * index,
* This routine returns the restriction clauses only.
*/
#ifdef NOT_USED
static List *
static List *
extract_restrict_clauses(List * clausegroup)
{
List *restrict_cls = NIL;
List *l;
List *restrict_cls = NIL;
List *l;
foreach(l, clausegroup)
{
CInfo *cinfo = lfirst(l);
CInfo *cinfo = lfirst(l);
if (!join_clause_p((Node *) cinfo->clause))
{
@ -1196,21 +1196,21 @@ extract_restrict_clauses(List * clausegroup)
* Returns a list of index pathnodes.
*
*/
static List *
static List *
index_innerjoin(Query * root, Rel * rel, List * clausegroup_list, Rel * index)
{
List *clausegroup = NIL;
List *cg_list = NIL;
List *i = NIL;
IndexPath *pathnode = (IndexPath *) NULL;
Cost temp_selec;
float temp_pages;
List *clausegroup = NIL;
List *cg_list = NIL;
List *i = NIL;
IndexPath *pathnode = (IndexPath *) NULL;
Cost temp_selec;
float temp_pages;
foreach(i, clausegroup_list)
{
List *attnos,
*values,
*flags;
List *attnos,
*values,
*flags;
clausegroup = lfirst(i);
pathnode = makeNode(IndexPath);
@ -1281,24 +1281,24 @@ index_innerjoin(Query * root, Rel * rel, List * clausegroup_list, Rel * index)
* Returns a list of new index path nodes.
*
*/
static List *
static List *
create_index_paths(Query * root,
Rel * rel,
Rel * index,
List * clausegroup_list,
bool join)
{
List *clausegroup = NIL;
List *ip_list = NIL;
List *i = NIL;
List *j = NIL;
IndexPath *temp_path;
List *clausegroup = NIL;
List *ip_list = NIL;
List *i = NIL;
List *j = NIL;
IndexPath *temp_path;
foreach(i, clausegroup_list)
{
CInfo *clauseinfo;
List *temp_node = NIL;
bool temp = true;
CInfo *clauseinfo;
List *temp_node = NIL;
bool temp = true;
clausegroup = lfirst(i);
@ -1324,21 +1324,21 @@ create_index_paths(Query * root,
return (ip_list);
}
static List *
static List *
add_index_paths(List * indexpaths, List * new_indexpaths)
{
return append(indexpaths, new_indexpaths);
}
static bool
static bool
function_index_operand(Expr * funcOpnd, Rel * rel, Rel * index)
{
Oid heapRelid = (Oid) lfirsti(rel->relids);
Func *function;
List *funcargs;
int *indexKeys = index->indexkeys;
List *arg;
int i;
Oid heapRelid = (Oid) lfirsti(rel->relids);
Func *function;
List *funcargs;
int *indexKeys = index->indexkeys;
List *arg;
int i;
/*
* sanity check, make sure we know what we're dealing with here.
@ -1390,7 +1390,7 @@ function_index_operand(Expr * funcOpnd, Rel * rel, Rel * index)
return true;
}
static bool
static bool
SingleAttributeIndex(Rel * index)
{

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.3 1997/09/07 04:43:38 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.4 1997/09/08 02:24:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -29,19 +29,19 @@
#include "optimizer/cost.h" /* for _enable_{hashjoin,
* _enable_mergesort} */
static Path *best_innerjoin(List * join_paths, List * outer_relid);
static List *
static Path *best_innerjoin(List * join_paths, List * outer_relid);
static List *
sort_inner_and_outer(Rel * joinrel, Rel * outerrel, Rel * innerrel,
List * mergeinfo_list);
static List *
static List *
match_unsorted_outer(Rel * joinrel, Rel * outerrel, Rel * innerrel,
List * outerpath_list, Path * cheapest_inner, Path * best_innerjoin,
List * mergeinfo_list);
static List *
static List *
match_unsorted_inner(Rel * joinrel, Rel * outerrel, Rel * innerrel,
List * innerpath_list, List * mergeinfo_list);
static bool EnoughMemoryForHashjoin(Rel * hashrel);
static List *
static bool EnoughMemoryForHashjoin(Rel * hashrel);
static List *
hash_inner_and_outer(Rel * joinrel, Rel * outerrel, Rel * innerrel,
List * hashinfo_list);
@ -69,20 +69,20 @@ hash_inner_and_outer(Rel * joinrel, Rel * outerrel, Rel * innerrel,
void
find_all_join_paths(Query * root, List * joinrels)
{
List *mergeinfo_list = NIL;
List *hashinfo_list = NIL;
List *temp_list = NIL;
List *path = NIL;
List *mergeinfo_list = NIL;
List *hashinfo_list = NIL;
List *temp_list = NIL;
List *path = NIL;
while (joinrels != NIL)
{
Rel *joinrel = (Rel *) lfirst(joinrels);
List *innerrelids;
List *outerrelids;
Rel *innerrel;
Rel *outerrel;
Path *bestinnerjoin;
List *pathlist = NIL;
Rel *joinrel = (Rel *) lfirst(joinrels);
List *innerrelids;
List *outerrelids;
Rel *innerrel;
Rel *outerrel;
Path *bestinnerjoin;
List *pathlist = NIL;
innerrelids = lsecond(joinrel->relids);
outerrelids = lfirst(joinrel->relids);
@ -205,15 +205,15 @@ find_all_join_paths(Query * root, List * joinrels)
*
* Returns the pathnode of the selected path.
*/
static Path *
static Path *
best_innerjoin(List * join_paths, List * outer_relids)
{
Path *cheapest = (Path *) NULL;
List *join_path;
Path *cheapest = (Path *) NULL;
List *join_path;
foreach(join_path, join_paths)
{
Path *path = (Path *) lfirst(join_path);
Path *path = (Path *) lfirst(join_path);
if (intMember(lfirsti(path->joinid), outer_relids)
&& ((cheapest == NULL ||
@ -239,19 +239,19 @@ best_innerjoin(List * join_paths, List * outer_relids)
*
* Returns a list of mergesort paths.
*/
static List *
static List *
sort_inner_and_outer(Rel * joinrel,
Rel * outerrel,
Rel * innerrel,
List * mergeinfo_list)
{
List *ms_list = NIL;
MInfo *xmergeinfo = (MInfo *) NULL;
MergePath *temp_node = (MergePath *) NULL;
List *i;
List *outerkeys = NIL;
List *innerkeys = NIL;
List *merge_pathkeys = NIL;
List *ms_list = NIL;
MInfo *xmergeinfo = (MInfo *) NULL;
MergePath *temp_node = (MergePath *) NULL;
List *i;
List *outerkeys = NIL;
List *innerkeys = NIL;
List *merge_pathkeys = NIL;
foreach(i, mergeinfo_list)
{
@ -317,7 +317,7 @@ sort_inner_and_outer(Rel * joinrel,
*
* Returns a list of possible join path nodes.
*/
static List *
static List *
match_unsorted_outer(Rel * joinrel,
Rel * outerrel,
Rel * innerrel,
@ -326,21 +326,21 @@ match_unsorted_outer(Rel * joinrel,
Path * best_innerjoin,
List * mergeinfo_list)
{
Path *outerpath = (Path *) NULL;
List *jp_list = NIL;
List *temp_node = NIL;
List *merge_pathkeys = NIL;
Path *nestinnerpath = (Path *) NULL;
List *paths = NIL;
List *i = NIL;
PathOrder *outerpath_ordering = NULL;
Path *outerpath = (Path *) NULL;
List *jp_list = NIL;
List *temp_node = NIL;
List *merge_pathkeys = NIL;
Path *nestinnerpath = (Path *) NULL;
List *paths = NIL;
List *i = NIL;
PathOrder *outerpath_ordering = NULL;
foreach(i, outerpath_list)
{
List *clauses = NIL;
List *matchedJoinKeys = NIL;
List *matchedJoinClauses = NIL;
MInfo *xmergeinfo = (MInfo *) NULL;
List *clauses = NIL;
List *matchedJoinKeys = NIL;
List *matchedJoinClauses = NIL;
MInfo *xmergeinfo = (MInfo *) NULL;
outerpath = (Path *) lfirst(i);
@ -360,8 +360,8 @@ match_unsorted_outer(Rel * joinrel,
if (clauses)
{
List *keys = xmergeinfo->jmethod.jmkeys;
List *clauses = xmergeinfo->jmethod.clauses;
List *keys = xmergeinfo->jmethod.jmkeys;
List *clauses = xmergeinfo->jmethod.clauses;
matchedJoinKeys =
match_pathkeys_joinkeys(outerpath->keys,
@ -397,9 +397,9 @@ match_unsorted_outer(Rel * joinrel,
if (clauses && matchedJoinKeys)
{
bool path_is_cheaper_than_sort;
List *varkeys = NIL;
Path *mergeinnerpath =
bool path_is_cheaper_than_sort;
List *varkeys = NIL;
Path *mergeinnerpath =
match_paths_joinkeys(matchedJoinKeys,
outerpath_ordering,
innerrel->pathlist,
@ -484,27 +484,27 @@ match_unsorted_outer(Rel * joinrel,
*
* Returns a list of possible merge paths.
*/
static List *
static List *
match_unsorted_inner(Rel * joinrel,
Rel * outerrel,
Rel * innerrel,
List * innerpath_list,
List * mergeinfo_list)
{
Path *innerpath = (Path *) NULL;
List *mp_list = NIL;
List *temp_node = NIL;
PathOrder *innerpath_ordering = NULL;
Cost temp1 = 0.0;
bool temp2 = false;
List *i = NIL;
Path *innerpath = (Path *) NULL;
List *mp_list = NIL;
List *temp_node = NIL;
PathOrder *innerpath_ordering = NULL;
Cost temp1 = 0.0;
bool temp2 = false;
List *i = NIL;
foreach(i, innerpath_list)
{
MInfo *xmergeinfo = (MInfo *) NULL;
List *clauses = NIL;
List *matchedJoinKeys = NIL;
List *matchedJoinClauses = NIL;
MInfo *xmergeinfo = (MInfo *) NULL;
List *clauses = NIL;
List *matchedJoinKeys = NIL;
List *matchedJoinClauses = NIL;
innerpath = (Path *) lfirst(i);
@ -524,8 +524,8 @@ match_unsorted_inner(Rel * joinrel,
if (clauses)
{
List *keys = xmergeinfo->jmethod.jmkeys;
List *cls = xmergeinfo->jmethod.clauses;
List *keys = xmergeinfo->jmethod.jmkeys;
List *cls = xmergeinfo->jmethod.clauses;
matchedJoinKeys =
match_pathkeys_joinkeys(innerpath->keys,
@ -550,11 +550,11 @@ match_unsorted_inner(Rel * joinrel,
if (temp2)
{
List *outerkeys =
List *outerkeys =
extract_path_keys(matchedJoinKeys,
outerrel->targetlist,
OUTER);
List *merge_pathkeys =
List *merge_pathkeys =
new_join_pathkeys(outerkeys,
joinrel->targetlist,
clauses);
@ -582,12 +582,12 @@ match_unsorted_inner(Rel * joinrel,
}
static bool
static bool
EnoughMemoryForHashjoin(Rel * hashrel)
{
int ntuples;
int tupsize;
int pages;
int ntuples;
int tupsize;
int pages;
ntuples = hashrel->size;
if (ntuples == 0)
@ -616,19 +616,19 @@ EnoughMemoryForHashjoin(Rel * hashrel)
*
* Returns a list of hashjoin paths.
*/
static List *
static List *
hash_inner_and_outer(Rel * joinrel,
Rel * outerrel,
Rel * innerrel,
List * hashinfo_list)
{
HInfo *xhashinfo = (HInfo *) NULL;
List *hjoin_list = NIL;
HashPath *temp_node = (HashPath *) NULL;
List *i = NIL;
List *outerkeys = NIL;
List *innerkeys = NIL;
List *hash_pathkeys = NIL;
HInfo *xhashinfo = (HInfo *) NULL;
List *hjoin_list = NIL;
HashPath *temp_node = (HashPath *) NULL;
List *i = NIL;
List *outerkeys = NIL;
List *innerkeys = NIL;
List *hash_pathkeys = NIL;
foreach(i, hashinfo_list)
{

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.5 1997/09/07 04:43:40 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.6 1997/09/08 02:24:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -24,23 +24,23 @@
#include "optimizer/pathnode.h"
#ifdef USE_RIGHT_SIDED_PLANS
bool _use_right_sided_plans_ = true;
bool _use_right_sided_plans_ = true;
#else
bool _use_right_sided_plans_ = false;
bool _use_right_sided_plans_ = false;
#endif
static List *find_clause_joins(Query * root, Rel * outer_rel, List * joininfo_list);
static List *find_clauseless_joins(Rel * outer_rel, List * inner_rels);
static Rel *init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo);
static List *
static List *find_clause_joins(Query * root, Rel * outer_rel, List * joininfo_list);
static List *find_clauseless_joins(Rel * outer_rel, List * inner_rels);
static Rel *init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo);
static List *
new_join_tlist(List * tlist, List * other_relids,
int first_resdomno);
static List *new_joininfo_list(List * joininfo_list, List * join_relids);
static void add_superrels(Rel * rel, Rel * super_rel);
static bool nonoverlap_rels(Rel * rel1, Rel * rel2);
static bool nonoverlap_sets(List * s1, List * s2);
static List *new_joininfo_list(List * joininfo_list, List * join_relids);
static void add_superrels(Rel * rel, Rel * super_rel);
static bool nonoverlap_rels(Rel * rel1, Rel * rel2);
static bool nonoverlap_sets(List * s1, List * s2);
static void
set_joinrel_size(Rel * joinrel, Rel * outer_rel, Rel * inner_rel,
JInfo * jinfo);
@ -58,16 +58,16 @@ set_joinrel_size(Rel * joinrel, Rel * outer_rel, Rel * inner_rel,
*
* Returns a list of rel nodes corresponding to the new join relations.
*/
List *
List *
find_join_rels(Query * root, List * outer_rels)
{
List *joins = NIL;
List *join_list = NIL;
List *r = NIL;
List *joins = NIL;
List *join_list = NIL;
List *r = NIL;
foreach(r, outer_rels)
{
Rel *outer_rel = (Rel *) lfirst(r);
Rel *outer_rel = (Rel *) lfirst(r);
if (!(joins = find_clause_joins(root, outer_rel, outer_rel->joininfo)))
if (BushyPlanFlag)
@ -96,20 +96,20 @@ find_join_rels(Query * root, List * outer_rels)
*
* Returns a list of new join relations.
*/
static List *
static List *
find_clause_joins(Query * root, Rel * outer_rel, List * joininfo_list)
{
List *join_list = NIL;
List *i = NIL;
List *join_list = NIL;
List *i = NIL;
foreach(i, joininfo_list)
{
JInfo *joininfo = (JInfo *) lfirst(i);
Rel *rel;
JInfo *joininfo = (JInfo *) lfirst(i);
Rel *rel;
if (!joininfo->inactive)
{
List *other_rels = joininfo->otherrels;
List *other_rels = joininfo->otherrels;
if (other_rels != NIL)
{
@ -157,13 +157,13 @@ find_clause_joins(Query * root, Rel * outer_rel, List * joininfo_list)
*
* Returns a list of new join relations.
*/
static List *
static List *
find_clauseless_joins(Rel * outer_rel, List * inner_rels)
{
Rel *inner_rel;
List *t_list = NIL;
List *temp_node = NIL;
List *i = NIL;
Rel *inner_rel;
List *t_list = NIL;
List *temp_node = NIL;
List *i = NIL;
foreach(i, inner_rels)
{
@ -192,13 +192,13 @@ find_clauseless_joins(Rel * outer_rel, List * inner_rels)
*
* Returns the new join relation node.
*/
static Rel *
static Rel *
init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo)
{
Rel *joinrel = makeNode(Rel);
List *joinrel_joininfo_list = NIL;
List *new_outer_tlist;
List *new_inner_tlist;
Rel *joinrel = makeNode(Rel);
List *joinrel_joininfo_list = NIL;
List *new_outer_tlist;
List *new_inner_tlist;
/*
* Create a new tlist by removing irrelevant elements from both tlists
@ -272,18 +272,18 @@ init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo)
*
* Returns the new target list.
*/
static List *
static List *
new_join_tlist(List * tlist,
List * other_relids,
int first_resdomno)
{
int resdomno = first_resdomno - 1;
TargetEntry *xtl = NULL;
List *temp_node = NIL;
List *t_list = NIL;
List *i = NIL;
List *join_list = NIL;
bool in_final_tlist = false;
int resdomno = first_resdomno - 1;
TargetEntry *xtl = NULL;
List *temp_node = NIL;
List *t_list = NIL;
List *i = NIL;
List *join_list = NIL;
bool in_final_tlist = false;
foreach(i, tlist)
@ -322,18 +322,18 @@ new_join_tlist(List * tlist,
*
* Returns a list of joininfo nodes, new and old.
*/
static List *
static List *
new_joininfo_list(List * joininfo_list, List * join_relids)
{
List *current_joininfo_list = NIL;
List *new_otherrels = NIL;
JInfo *other_joininfo = (JInfo *) NULL;
List *xjoininfo = NIL;
List *current_joininfo_list = NIL;
List *new_otherrels = NIL;
JInfo *other_joininfo = (JInfo *) NULL;
List *xjoininfo = NIL;
foreach(xjoininfo, joininfo_list)
{
List *or;
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
List *or;
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
new_otherrels = joininfo->otherrels;
foreach(or, new_otherrels)
@ -389,42 +389,42 @@ new_joininfo_list(List * joininfo_list, List * join_relids)
void
add_new_joininfos(Query * root, List * joinrels, List * outerrels)
{
List *xjoinrel = NIL;
List *xrelid = NIL;
List *xrel = NIL;
List *xjoininfo = NIL;
List *xjoinrel = NIL;
List *xrelid = NIL;
List *xrel = NIL;
List *xjoininfo = NIL;
foreach(xjoinrel, joinrels)
{
Rel *joinrel = (Rel *) lfirst(xjoinrel);
Rel *joinrel = (Rel *) lfirst(xjoinrel);
foreach(xrelid, joinrel->relids)
{
Relid relid = (Relid) lfirst(xrelid);
Rel *rel = get_join_rel(root, relid);
Relid relid = (Relid) lfirst(xrelid);
Rel *rel = get_join_rel(root, relid);
add_superrels(rel, joinrel);
}
}
foreach(xjoinrel, joinrels)
{
Rel *joinrel = (Rel *) lfirst(xjoinrel);
Rel *joinrel = (Rel *) lfirst(xjoinrel);
foreach(xjoininfo, joinrel->joininfo)
{
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
List *other_rels = joininfo->otherrels;
List *clause_info = joininfo->jinfoclauseinfo;
bool mergesortable = joininfo->mergesortable;
bool hashjoinable = joininfo->hashjoinable;
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
List *other_rels = joininfo->otherrels;
List *clause_info = joininfo->jinfoclauseinfo;
bool mergesortable = joininfo->mergesortable;
bool hashjoinable = joininfo->hashjoinable;
foreach(xrelid, other_rels)
{
Relid relid = (Relid) lfirst(xrelid);
Rel *rel = get_join_rel(root, relid);
List *super_rels = rel->superrels;
List *xsuper_rel = NIL;
JInfo *new_joininfo = makeNode(JInfo);
Relid relid = (Relid) lfirst(xrelid);
Rel *rel = get_join_rel(root, relid);
List *super_rels = rel->superrels;
List *xsuper_rel = NIL;
JInfo *new_joininfo = makeNode(JInfo);
new_joininfo->otherrels = joinrel->relids;
new_joininfo->jinfoclauseinfo = clause_info;
@ -436,12 +436,12 @@ add_new_joininfos(Query * root, List * joinrels, List * outerrels)
foreach(xsuper_rel, super_rels)
{
Rel *super_rel = (Rel *) lfirst(xsuper_rel);
Rel *super_rel = (Rel *) lfirst(xsuper_rel);
if (nonoverlap_rels(super_rel, joinrel))
{
List *new_relids = super_rel->relids;
JInfo *other_joininfo =
List *new_relids = super_rel->relids;
JInfo *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);
JInfo *new_joininfo = makeNode(JInfo);
new_joininfo->otherrels = new_relids;
new_joininfo->jinfoclauseinfo = clause_info;
@ -471,7 +471,7 @@ add_new_joininfos(Query * root, List * joinrels, List * outerrels)
}
foreach(xrel, outerrels)
{
Rel *rel = (Rel *) lfirst(xrel);
Rel *rel = (Rel *) lfirst(xrel);
rel->superrels = NIL;
}
@ -486,12 +486,12 @@ add_new_joininfos(Query * root, List * joinrels, List * outerrels)
*
* Returns the list of final join relations.
*/
List *
List *
final_join_rels(List * join_rel_list)
{
List *xrel = NIL;
List *temp = NIL;
List *t_list = NIL;
List *xrel = NIL;
List *temp = NIL;
List *t_list = NIL;
/*
* find the relations that has no further joins, i.e., its joininfos
@ -499,13 +499,13 @@ final_join_rels(List * join_rel_list)
*/
foreach(xrel, join_rel_list)
{
Rel *rel = (Rel *) lfirst(xrel);
List *xjoininfo = NIL;
bool final = true;
Rel *rel = (Rel *) lfirst(xrel);
List *xjoininfo = NIL;
bool final = true;
foreach(xjoininfo, rel->joininfo)
{
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
if (joininfo->otherrels != NIL)
{
@ -547,20 +547,20 @@ add_superrels(Rel * rel, Rel * super_rel)
*
* Returns non-nil if rel1 and rel2 do not overlap.
*/
static bool
static bool
nonoverlap_rels(Rel * rel1, Rel * rel2)
{
return (nonoverlap_sets(rel1->relids, rel2->relids));
}
static bool
static bool
nonoverlap_sets(List * s1, List * s2)
{
List *x = NIL;
List *x = NIL;
foreach(x, s1)
{
int e = lfirsti(x);
int e = lfirsti(x);
if (intMember(e, s2))
return (false);
@ -571,8 +571,8 @@ nonoverlap_sets(List * s1, List * s2)
static void
set_joinrel_size(Rel * joinrel, Rel * outer_rel, Rel * inner_rel, JInfo * jinfo)
{
int ntuples;
float selec;
int ntuples;
float selec;
/*
* voodoo magic. but better than a size of 0. I have no idea why we

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.2 1997/09/07 04:43:42 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.3 1997/09/08 02:24:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -32,11 +32,11 @@ match_pathkey_joinkeys(List * pathkey, List * joinkeys,
static bool
every_func(List * joinkeys, List * pathkey,
int which_subkey);
static List *
static List *
new_join_pathkey(List * subkeys,
List * considered_subkeys, List * join_rel_tlist,
List * joinclauses);
static List *
static List *
new_matching_subkeys(Var * subkey, List * considered_subkeys,
List * join_rel_tlist, List * joinclauses);
@ -73,18 +73,18 @@ new_matching_subkeys(Var * subkey, List * considered_subkeys,
* Returns a list of matched join keys and a list of matched join clauses
* in matchedJoinClausesPtr. - ay 11/94
*/
List *
List *
match_pathkeys_joinkeys(List * pathkeys,
List * joinkeys,
List * joinclauses,
int which_subkey,
List ** matchedJoinClausesPtr)
{
List *matched_joinkeys = NIL;
List *matched_joinclauses = NIL;
List *pathkey = NIL;
List *i = NIL;
int matched_joinkey_index = -1;
List *matched_joinkeys = NIL;
List *matched_joinclauses = NIL;
List *pathkey = NIL;
List *i = NIL;
int matched_joinkey_index = -1;
foreach(i, pathkeys)
{
@ -94,8 +94,8 @@ match_pathkeys_joinkeys(List * pathkeys,
if (matched_joinkey_index != -1)
{
List *xjoinkey = nth(matched_joinkey_index, joinkeys);
List *joinclause = nth(matched_joinkey_index, joinclauses);
List *xjoinkey = nth(matched_joinkey_index, joinkeys);
List *joinclause = nth(matched_joinkey_index, joinclauses);
/* XXX was "push" function */
matched_joinkeys = lappend(matched_joinkeys, xjoinkey);
@ -131,11 +131,11 @@ match_pathkey_joinkeys(List * pathkey,
List * joinkeys,
int which_subkey)
{
Var *path_subkey;
int pos;
List *i = NIL;
List *x = NIL;
JoinKey *jk;
Var *path_subkey;
int pos;
List *i = NIL;
List *x = NIL;
JoinKey *jk;
foreach(i, pathkey)
{
@ -174,15 +174,15 @@ match_pathkey_joinkeys(List * pathkey,
*
* Returns the matching path node if one exists, nil otherwise.
*/
static bool
static bool
every_func(List * joinkeys, List * pathkey, int which_subkey)
{
JoinKey *xjoinkey;
Var *temp;
Var *tempkey = NULL;
bool found = false;
List *i = NIL;
List *j = NIL;
JoinKey *xjoinkey;
Var *temp;
Var *tempkey = NULL;
bool found = false;
List *i = NIL;
List *j = NIL;
foreach(i, joinkeys)
{
@ -211,19 +211,19 @@ every_func(List * joinkeys, List * pathkey, int which_subkey)
* match_paths_joinkeys -
* find the cheapest path that matches the join keys
*/
Path *
Path *
match_paths_joinkeys(List * joinkeys,
PathOrder * ordering,
List * paths,
int which_subkey)
{
Path *matched_path = NULL;
bool key_match = false;
List *i = NIL;
Path *matched_path = NULL;
bool key_match = false;
List *i = NIL;
foreach(i, paths)
{
Path *path = (Path *) lfirst(i);
Path *path = (Path *) lfirst(i);
key_match = every_func(joinkeys, path->keys, which_subkey);
@ -263,20 +263,20 @@ match_paths_joinkeys(List * joinkeys,
* Returns a list of pathkeys: ((tlvar1)(tlvar2)...(tlvarN)).
* [I've no idea why they have to be list of lists. Should be fixed. -ay 12/94]
*/
List *
List *
extract_path_keys(List * joinkeys,
List * tlist,
int which_subkey)
{
List *pathkeys = NIL;
List *jk;
List *pathkeys = NIL;
List *jk;
foreach(jk, joinkeys)
{
JoinKey *jkey = (JoinKey *) lfirst(jk);
Var *var,
*key;
List *p;
JoinKey *jkey = (JoinKey *) lfirst(jk);
Var *var,
*key;
List *p;
/*
* find the right Var in the target list for this key
@ -289,7 +289,7 @@ extract_path_keys(List * joinkeys,
*/
foreach(p, pathkeys)
{
Var *pkey = lfirst((List *) lfirst(p)); /* XXX fix me */
Var *pkey = lfirst((List *) lfirst(p)); /* XXX fix me */
if (key == pkey)
break;
@ -325,15 +325,15 @@ extract_path_keys(List * joinkeys,
* Returns the list of new path keys.
*
*/
List *
List *
new_join_pathkeys(List * outer_pathkeys,
List * join_rel_tlist,
List * joinclauses)
{
List *outer_pathkey = NIL;
List *t_list = NIL;
List *x;
List *i = NIL;
List *outer_pathkey = NIL;
List *t_list = NIL;
List *x;
List *i = NIL;
foreach(i, outer_pathkeys)
{
@ -365,18 +365,18 @@ new_join_pathkeys(List * outer_pathkeys,
* Returns a new pathkey(list of subkeys).
*
*/
static List *
static List *
new_join_pathkey(List * subkeys,
List * considered_subkeys,
List * join_rel_tlist,
List * joinclauses)
{
List *t_list = NIL;
Var *subkey;
List *i = NIL;
List *matched_subkeys = NIL;
Expr *tlist_key = (Expr *) NULL;
List *newly_considered_subkeys = NIL;
List *t_list = NIL;
Var *subkey;
List *i = NIL;
List *matched_subkeys = NIL;
Expr *tlist_key = (Expr *) NULL;
List *newly_considered_subkeys = NIL;
foreach(i, subkeys)
{
@ -425,17 +425,17 @@ new_join_pathkey(List * subkeys,
* Returns a list of new subkeys.
*
*/
static List *
static List *
new_matching_subkeys(Var * subkey,
List * considered_subkeys,
List * join_rel_tlist,
List * joinclauses)
{
Expr *joinclause = NULL;
List *t_list = NIL;
List *temp = NIL;
List *i = NIL;
Expr *tlist_other_var = (Expr *) NULL;
Expr *joinclause = NULL;
List *t_list = NIL;
List *temp = NIL;
List *i = NIL;
Expr *tlist_other_var = (Expr *) NULL;
foreach(i, joinclauses)
{

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.2 1997/09/07 04:43:45 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.3 1997/09/08 02:24:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -33,17 +33,17 @@
* Returns the new list of mergeinfo nodes.
*
*/
List *
List *
group_clauses_by_order(List * clauseinfo_list,
int inner_relid)
{
List *mergeinfo_list = NIL;
List *xclauseinfo = NIL;
List *mergeinfo_list = NIL;
List *xclauseinfo = NIL;
foreach(xclauseinfo, clauseinfo_list)
{
CInfo *clauseinfo = (CInfo *) lfirst(xclauseinfo);
MergeOrder *merge_ordering = clauseinfo->mergesortorder;
CInfo *clauseinfo = (CInfo *) lfirst(xclauseinfo);
MergeOrder *merge_ordering = clauseinfo->mergesortorder;
if (merge_ordering)
{
@ -52,12 +52,12 @@ group_clauses_by_order(List * clauseinfo_list,
* Create a new mergeinfo node and add it to 'mergeinfo-list'
* if one does not yet exist for this merge ordering.
*/
PathOrder p_ordering;
MInfo *xmergeinfo;
Expr *clause = clauseinfo->clause;
Var *leftop = get_leftop(clause);
Var *rightop = get_rightop(clause);
JoinKey *keys;
PathOrder p_ordering;
MInfo *xmergeinfo;
Expr *clause = clauseinfo->clause;
Var *leftop = get_leftop(clause);
Var *rightop = get_rightop(clause);
JoinKey *keys;
p_ordering.ordtype = MERGE_ORDER;
p_ordering.ord.merge = merge_ordering;
@ -105,15 +105,15 @@ group_clauses_by_order(List * clauseinfo_list,
* Returns the node if it exists.
*
*/
MInfo *
MInfo *
match_order_mergeinfo(PathOrder * ordering, List * mergeinfo_list)
{
MergeOrder *xmergeorder;
List *xmergeinfo = NIL;
MergeOrder *xmergeorder;
List *xmergeinfo = NIL;
foreach(xmergeinfo, mergeinfo_list)
{
MInfo *mergeinfo = (MInfo *) lfirst(xmergeinfo);
MInfo *mergeinfo = (MInfo *) lfirst(xmergeinfo);
xmergeorder = mergeinfo->m_ordering;

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.2 1997/09/07 04:43:46 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.3 1997/09/08 02:24:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -50,15 +50,15 @@ best_or_subclause_index(Query * root, Rel * rel, Expr * subclause,
* Returns a list of these index path nodes.
*
*/
List *
List *
create_or_index_paths(Query * root,
Rel * rel, List * clauses)
{
List *t_list = NIL;
List *t_list = NIL;
if (clauses != NIL)
{
CInfo *clausenode = (CInfo *) (lfirst(clauses));
CInfo *clausenode = (CInfo *) (lfirst(clauses));
/*
* Check to see if this clause is an 'or' clause, and, if so,
@ -70,9 +70,9 @@ create_or_index_paths(Query * root,
if (valid_or_clause(clausenode) &&
clausenode->indexids)
{
List *temp = NIL;
List *index_list = NIL;
bool index_flag = true;
List *temp = NIL;
List *index_list = NIL;
bool index_flag = true;
index_list = clausenode->indexids;
foreach(temp, index_list)
@ -82,10 +82,10 @@ create_or_index_paths(Query * root,
}
if (index_flag)
{ /* used to be a lisp every function */
IndexPath *pathnode = makeNode(IndexPath);
List *indexids;
Cost cost;
List *selecs;
IndexPath *pathnode = makeNode(IndexPath);
List *indexids;
Cost cost;
List *selecs;
best_or_subclause_indices(root,
rel,
@ -177,9 +177,9 @@ best_or_subclause_indices(Query * root,
}
else
{
int best_indexid;
Cost best_cost;
Cost best_selec;
int best_indexid;
Cost best_cost;
Cost best_selec;
best_or_subclause_index(root, rel, lfirst(subclauses), lfirst(indices),
&best_indexid, &best_cost, &best_selec);
@ -223,18 +223,18 @@ best_or_subclause_index(Query * root,
{
if (indices != NIL)
{
Datum value;
int flag = 0;
Cost subcost;
Rel *index = (Rel *) lfirst(indices);
AttrNumber attno = (get_leftop(subclause))->varattno;
Oid opno = ((Oper *) subclause->oper)->opno;
bool constant_on_right = non_null((Expr *) get_rightop(subclause));
float npages,
selec;
int subclause_indexid;
Cost subclause_cost;
Cost subclause_selec;
Datum value;
int flag = 0;
Cost subcost;
Rel *index = (Rel *) lfirst(indices);
AttrNumber attno = (get_leftop(subclause))->varattno;
Oid opno = ((Oper *) subclause->oper)->opno;
bool constant_on_right = non_null((Expr *) get_rightop(subclause));
float npages,
selec;
int subclause_indexid;
Cost subclause_cost;
Cost subclause_selec;
if (constant_on_right)
{

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.3 1997/09/07 04:43:47 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.4 1997/09/08 02:24:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -57,28 +57,28 @@
static void
xfunc_predmig(JoinPath pathnode, Stream streamroot,
Stream laststream, bool * progressp);
static bool xfunc_series_llel(Stream stream);
static bool xfunc_llel_chains(Stream root, Stream bottom);
static Stream xfunc_complete_stream(Stream stream);
static bool xfunc_series_llel(Stream stream);
static bool xfunc_llel_chains(Stream root, Stream bottom);
static Stream xfunc_complete_stream(Stream stream);
static bool
xfunc_prdmig_pullup(Stream origstream, Stream pullme,
JoinPath joinpath);
static void xfunc_form_groups(Stream root, Stream bottom);
static void xfunc_free_stream(Stream root);
static Stream xfunc_add_clauses(Stream current);
static void xfunc_setup_group(Stream node, Stream bottom);
static void xfunc_form_groups(Stream root, Stream bottom);
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,
int clausetype);
static int xfunc_num_relids(Stream node);
static int xfunc_num_relids(Stream node);
static StreamPtr xfunc_get_downjoin(Stream node);
static StreamPtr xfunc_get_upjoin(Stream node);
static Stream xfunc_stream_qsort(Stream root, Stream bottom);
static int xfunc_stream_compare(void *arg1, void *arg2);
static bool xfunc_check_stream(Stream node);
static bool xfunc_in_stream(Stream node, Stream stream);
static Stream xfunc_stream_qsort(Stream root, Stream bottom);
static int xfunc_stream_compare(void *arg1, void *arg2);
static bool xfunc_check_stream(Stream node);
static bool xfunc_in_stream(Stream node, Stream stream);
/* ----------------- MAIN FUNCTIONS ------------------------ */
/* ----------------- MAIN FUNCTIONS ------------------------ */
/*
** xfunc_do_predmig
** wrapper for Predicate Migration. It calls xfunc_predmig until no
@ -88,8 +88,8 @@ static bool xfunc_in_stream(Stream node, Stream stream);
bool
xfunc_do_predmig(Path root)
{
bool progress,
changed = false;
bool progress,
changed = false;
if (is_join(root))
do
@ -122,7 +122,7 @@ xfunc_predmig(JoinPath pathnode,/* root of the join tree */
* and the lowest node created so far */
bool * progressp)
{
Stream newstream;
Stream newstream;
/*
* * traverse the join tree dfs-style, constructing a stream as you
@ -153,7 +153,7 @@ xfunc_predmig(JoinPath pathnode,/* root of the join tree */
if (!is_join(pathnode))
{
/* form a fleshed-out copy of the stream */
Stream fullstream = xfunc_complete_stream(streamroot);
Stream fullstream = xfunc_complete_stream(streamroot);
/* sort it via series-llel */
if (xfunc_series_llel(fullstream))
@ -188,9 +188,9 @@ xfunc_predmig(JoinPath pathnode,/* root of the join tree */
static bool
xfunc_series_llel(Stream stream)
{
Stream temp,
next;
bool progress = false;
Stream temp,
next;
bool progress = false;
for (temp = stream; temp != (Stream) NULL; temp = next)
{
@ -219,11 +219,11 @@ xfunc_series_llel(Stream stream)
static bool
xfunc_llel_chains(Stream root, Stream bottom)
{
bool progress = false;
Stream origstream;
Stream tmpstream,
pathstream;
Stream rootcopy = root;
bool progress = false;
Stream origstream;
Stream tmpstream,
pathstream;
Stream rootcopy = root;
Assert(xfunc_check_stream(root));
@ -282,9 +282,9 @@ xfunc_llel_chains(Stream root, Stream bottom)
static Stream
xfunc_complete_stream(Stream stream)
{
Stream tmpstream,
copystream,
curstream = (Stream) NULL;
Stream tmpstream,
copystream,
curstream = (Stream) NULL;
copystream = (Stream) copyObject((Node) stream);
Assert(xfunc_check_stream(copystream));
@ -316,15 +316,15 @@ xfunc_complete_stream(Stream stream)
** nodes. We use the original stream to find out what joins are
** above the clause.
*/
static bool
static bool
xfunc_prdmig_pullup(Stream origstream, Stream pullme, JoinPath joinpath)
{
CInfo clauseinfo = get_cinfo(pullme);
bool progress = false;
Stream upjoin,
orignode,
temp;
int whichchild;
CInfo clauseinfo = get_cinfo(pullme);
bool progress = false;
Stream upjoin,
orignode,
temp;
int whichchild;
/* find node in origstream that contains clause */
for (orignode = origstream;
@ -412,12 +412,12 @@ xfunc_prdmig_pullup(Stream origstream, Stream pullme, JoinPath joinpath)
static void
xfunc_form_groups(Query * queryInfo, Stream root, Stream bottom)
{
Stream temp,
parent;
int lowest = xfunc_num_relids((Stream) xfunc_get_upjoin(bottom));
bool progress;
LispValue primjoin;
int whichchild;
Stream temp,
parent;
int lowest = xfunc_num_relids((Stream) xfunc_get_upjoin(bottom));
bool progress;
LispValue primjoin;
int whichchild;
if (!lowest)
return; /* no joins in stream, so no groups */
@ -495,7 +495,7 @@ xfunc_form_groups(Query * queryInfo, Stream root, Stream bottom)
}
/* ------------------- UTILITY FUNCTIONS ------------------------- */
/* ------------------- UTILITY FUNCTIONS ------------------------- */
/*
** xfunc_free_stream --
@ -504,8 +504,8 @@ xfunc_form_groups(Query * queryInfo, Stream root, Stream bottom)
static void
xfunc_free_stream(Stream root)
{
Stream cur,
next;
Stream cur,
next;
Assert(xfunc_check_stream(root));
@ -525,9 +525,9 @@ xfunc_free_stream(Stream root)
static Stream
xfunc_add_clauses(Stream current)
{
Stream topnode = current;
LispValue temp;
LispValue primjoin;
Stream topnode = current;
LispValue temp;
LispValue primjoin;
/* first add in the local clauses */
foreach(temp, get_locclauseinfo((Path) get_pathptr(current)))
@ -561,7 +561,7 @@ xfunc_add_clauses(Stream current)
static void
xfunc_setup_group(Stream node, Stream bottom)
{
Stream temp;
Stream temp;
if (node != bottom)
/* traverse downwards */
@ -598,12 +598,12 @@ xfunc_setup_group(Stream node, Stream bottom)
** Make a new Stream node to hold clause, and insert it above current.
** Return new node.
*/
static Stream
static Stream
xfunc_streaminsert(CInfo clauseinfo,
Stream current,
int clausetype) /* XFUNC_LOCPRD or XFUNC_JOINPRD */
{
Stream newstream = RMakeStream();
Stream newstream = RMakeStream();
set_upstream(newstream, get_upstream(current));
if (get_upstream(current))
@ -640,7 +640,7 @@ xfunc_num_relids(Stream node)
static StreamPtr
xfunc_get_downjoin(Stream node)
{
Stream temp;
Stream temp;
if (!is_clause(node)) /* if this is a join */
node = (Stream) get_downstream(node);
@ -658,7 +658,7 @@ xfunc_get_downjoin(Stream node)
static StreamPtr
xfunc_get_upjoin(Stream node)
{
Stream temp;
Stream temp;
if (!is_clause(node)) /* if this is a join */
node = (Stream) get_upstream(node);
@ -677,11 +677,11 @@ xfunc_get_upjoin(Stream node)
static Stream
xfunc_stream_qsort(Stream root, Stream bottom)
{
int i;
size_t num;
Stream *nodearray,
output;
Stream tmp;
int i;
size_t num;
Stream *nodearray,
output;
Stream tmp;
/* find size of list */
for (num = 0, tmp = root; tmp != bottom;
@ -725,10 +725,10 @@ xfunc_stream_qsort(Stream root, Stream bottom)
static int
xfunc_stream_compare(void *arg1, void *arg2)
{
Stream stream1 = *(Stream *) arg1;
Stream stream2 = *(Stream *) arg2;
Cost rank1,
rank2;
Stream stream1 = *(Stream *) arg1;
Stream stream2 = *(Stream *) arg2;
Cost rank1,
rank2;
rank1 = get_grouprank(stream1);
rank2 = get_grouprank(stream2);
@ -765,7 +765,7 @@ xfunc_stream_compare(void *arg1, void *arg2)
}
}
/* ------------------ DEBUGGING ROUTINES ---------------------------- */
/* ------------------ DEBUGGING ROUTINES ---------------------------- */
/*
** Make sure all pointers in stream make sense. Make sure no joins are
@ -774,9 +774,9 @@ xfunc_stream_compare(void *arg1, void *arg2)
static bool
xfunc_check_stream(Stream node)
{
Stream temp;
int numrelids,
tmp;
Stream temp;
int numrelids,
tmp;
/* set numrelids higher than max */
if (!is_clause(node))
@ -814,7 +814,7 @@ xfunc_check_stream(Stream node)
static bool
xfunc_in_stream(Stream node, Stream stream)
{
Stream temp;
Stream temp;
for (temp = stream; temp; temp = (Stream) get_downstream(temp))
if (temp == node)

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.4 1997/09/07 04:43:49 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.5 1997/09/08 02:24:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -24,7 +24,7 @@
#include "utils/elog.h"
static List *prune_joinrel(Rel * rel, List * other_rels);
static List *prune_joinrel(Rel * rel, List * other_rels);
/*
* prune-joinrels--
@ -34,10 +34,10 @@ static List *prune_joinrel(Rel * rel, List * other_rels);
* Returns the resulting list.
*
*/
List *
List *
prune_joinrels(List * rel_list)
{
List *temp_list = NIL;
List *temp_list = NIL;
if (rel_list != NIL)
{
@ -59,13 +59,13 @@ prune_joinrels(List * rel_list)
* of 'rel' appropriately.
*
*/
static List *
static List *
prune_joinrel(Rel * rel, List * other_rels)
{
List *i = NIL;
List *t_list = NIL;
List *temp_node = NIL;
Rel *other_rel = (Rel *) NULL;
List *i = NIL;
List *t_list = NIL;
List *temp_node = NIL;
Rel *other_rel = (Rel *) NULL;
foreach(i, other_rels)
{
@ -99,11 +99,11 @@ prune_joinrel(Rel * rel, List * other_rels)
void
prune_rel_paths(List * rel_list)
{
List *x = NIL;
List *y = NIL;
Path *path = NULL;
Rel *rel = (Rel *) NULL;
JoinPath *cheapest = (JoinPath *) NULL;
List *x = NIL;
List *y = NIL;
Path *path = NULL;
Rel *rel = (Rel *) NULL;
JoinPath *cheapest = (JoinPath *) NULL;
foreach(x, rel_list)
{
@ -139,10 +139,10 @@ prune_rel_paths(List * rel_list)
* Returns the cheapest path.
*
*/
Path *
Path *
prune_rel_path(Rel * rel, Path * unorderedpath)
{
Path *cheapest = set_cheapest(rel, rel->pathlist);
Path *cheapest = set_cheapest(rel, rel->pathlist);
/* don't prune if not pruneable -- JMH, 11/23/92 */
if (unorderedpath != cheapest
@ -170,14 +170,14 @@ prune_rel_path(Rel * rel, Path * unorderedpath)
*
* Returns one pruned rel node list
*/
List *
List *
merge_joinrels(List * rel_list1, List * rel_list2)
{
List *xrel = NIL;
List *xrel = NIL;
foreach(xrel, rel_list1)
{
Rel *rel = (Rel *) lfirst(xrel);
Rel *rel = (Rel *) lfirst(xrel);
rel_list2 = prune_joinrel(rel, rel_list2);
}
@ -196,12 +196,12 @@ merge_joinrels(List * rel_list1, List * rel_list2)
*
* Returns a new list of rel nodes
*/
List *
List *
prune_oldrels(List * old_rels)
{
Rel *rel;
List *joininfo_list,
*xjoininfo;
Rel *rel;
List *joininfo_list,
*xjoininfo;
if (old_rels == NIL)
return (NIL);
@ -213,7 +213,7 @@ prune_oldrels(List * old_rels)
foreach(xjoininfo, joininfo_list)
{
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
if (!joininfo->inactive)
return (lcons(rel, prune_oldrels(lnext(old_rels))));

View File

@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.4 1997/09/07 04:43:50 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.5 1997/09/08 02:24:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -62,13 +62,13 @@ xfunc_card_unreferenced(Query * queryInfo,
void
xfunc_trypullup(Rel rel)
{
LispValue y; /* list ptr */
CInfo maxcinfo; /* The CInfo to pull up, as calculated by
LispValue y; /* list ptr */
CInfo maxcinfo; /* The CInfo to pull up, as calculated by
* xfunc_shouldpull() */
JoinPath curpath; /* current path in list */
int progress; /* has progress been made this time
JoinPath curpath; /* current path in list */
int progress; /* has progress been made this time
* through? */
int clausetype;
int clausetype;
do
{
@ -153,17 +153,16 @@ xfunc_shouldpull(Query * queryInfo,
CInfo * maxcinfopt) /* Out: pointer to clause to
* pullup */
{
LispValue clauselist,
tmplist; /* lists of clauses */
CInfo maxcinfo; /* clause to pullup */
LispValue primjoinclause /* primary join clause */
LispValue clauselist,
tmplist; /* lists of clauses */
CInfo maxcinfo; /* clause to pullup */
LispValue primjoinclause /* primary join clause */
= xfunc_primary_join(parentpath);
Cost tmprank,
maxrank = (-1 * MAXFLOAT); /* ranks of clauses */
Cost joinselec = 0; /* selectivity of the join
* predicate */
Cost joincost = 0; /* join cost + primjoinclause cost */
int retval = XFUNC_LOCPRD;
Cost tmprank,
maxrank = (-1 * MAXFLOAT); /* ranks of clauses */
Cost joinselec = 0; /* selectivity of the join predicate */
Cost joincost = 0; /* join cost + primjoinclause cost */
int retval = XFUNC_LOCPRD;
clauselist = get_locclauseinfo(childpath);
@ -275,11 +274,11 @@ xfunc_pullup(Query * queryInfo,
int whichchild, /* whether child is INNER or OUTER of join */
int clausetype) /* whether clause to pull is join or local */
{
Path newkid;
Rel newrel;
Cost pulled_selec;
Cost cost;
CInfo newinfo;
Path newkid;
Rel newrel;
Cost pulled_selec;
Cost cost;
CInfo newinfo;
/* remove clause from childpath */
newkid = (Path) copyObject((Node) childpath);
@ -363,8 +362,8 @@ xfunc_pullup(Query * queryInfo,
Cost
xfunc_rank(Query * queryInfo, LispValue clause)
{
Cost selec = compute_clause_selec(queryInfo, clause, LispNil);
Cost cost = xfunc_expense(queryInfo, clause);
Cost selec = compute_clause_selec(queryInfo, clause, LispNil);
Cost cost = xfunc_expense(queryInfo, clause);
if (cost == 0)
if (selec > 1)
@ -381,13 +380,13 @@ xfunc_rank(Query * queryInfo, LispValue clause)
*/
Cost
xfunc_expense(Query * queryInfo, clause)
LispValue clause;
LispValue clause;
{
Cost cost = xfunc_local_expense(clause);
Cost cost = xfunc_local_expense(clause);
if (cost)
{
Count card = xfunc_card_unreferenced(queryInfo, clause, LispNil);
Count card = xfunc_card_unreferenced(queryInfo, clause, LispNil);
if (card)
cost /= card;
@ -403,15 +402,15 @@ LispValue clause;
Cost
xfunc_join_expense(Query * queryInfo, JoinPath path, int whichchild)
{
LispValue primjoinclause = xfunc_primary_join(path);
LispValue primjoinclause = xfunc_primary_join(path);
/*
* * the second argument to xfunc_card_unreferenced reflects all the *
* relations involved in the join clause, i.e. all the relids in the
* Rel * of the join clause
*/
Count card = 0;
Cost cost = xfunc_expense_per_tuple(path, whichchild);
Count card = 0;
Cost cost = xfunc_expense_per_tuple(path, whichchild);
card = xfunc_card_unreferenced(queryInfo,
primjoinclause,
@ -432,8 +431,8 @@ xfunc_join_expense(Query * queryInfo, JoinPath path, int whichchild)
Cost
xfunc_local_expense(LispValue clause)
{
Cost cost = 0; /* running expense */
LispValue tmpclause;
Cost cost = 0; /* running expense */
LispValue tmpclause;
/* First handle the base case */
if (IsA(clause, Const) || IsA(clause, Var) || IsA(clause, Param))
@ -484,15 +483,15 @@ xfunc_local_expense(LispValue clause)
Cost
xfunc_func_expense(LispValue node, LispValue args)
{
HeapTuple tupl; /* the pg_proc tuple for each function */
Form_pg_proc proc; /* a data structure to hold the pg_proc
HeapTuple tupl; /* the pg_proc tuple for each function */
Form_pg_proc proc; /* a data structure to hold the pg_proc
* tuple */
int width = 0; /* byte width of the field referenced by
int width = 0; /* byte width of the field referenced by
* each clause */
RegProcedure funcid; /* ID of function associate with node */
Cost cost = 0; /* running expense */
LispValue tmpclause;
LispValue operand; /* one operand of an operator */
RegProcedure funcid; /* ID of function associate with node */
Cost cost = 0; /* running expense */
LispValue tmpclause;
LispValue operand; /* one operand of an operator */
if (IsA(node, Oper))
{
@ -517,15 +516,15 @@ xfunc_func_expense(LispValue node, LispValue args)
*/
if (proc->prolang == SQLlanguageId)
{
LispValue tmpplan;
List planlist;
LispValue tmpplan;
List planlist;
if (IsA(node, Oper) || get_func_planlist((Func) node) == LispNil)
{
Oid *argOidVect; /* vector of argtypes */
char *pq_src; /* text of PQ function */
int nargs; /* num args to PQ function */
QueryTreeList *queryTree_list; /* dummy variable */
Oid *argOidVect; /* vector of argtypes */
char *pq_src; /* text of PQ function */
int nargs; /* num args to PQ function */
QueryTreeList *queryTree_list; /* dummy variable */
/*
* * plan the function, storing it in the Func node for later *
@ -599,10 +598,10 @@ xfunc_func_expense(LispValue node, LispValue args)
int
xfunc_width(LispValue clause)
{
Relation rd; /* Relation Descriptor */
HeapTuple tupl; /* structure to hold a cached tuple */
TypeTupleForm type; /* structure to hold a type tuple */
int retval = 0;
Relation rd; /* Relation Descriptor */
HeapTuple tupl; /* structure to hold a cached tuple */
TypeTupleForm type; /* structure to hold a type tuple */
int retval = 0;
if (IsA(clause, Const))
{
@ -695,7 +694,7 @@ xfunc_width(LispValue clause)
}
else if (fast_is_funcclause(clause))
{
Func func = (Func) get_function(clause);
Func func = (Func) get_function(clause);
if (get_func_tlist(func) != LispNil)
{
@ -735,13 +734,13 @@ exit:
** User may pass in referenced list, if they know it (useful
** for joins).
*/
static Count
static Count
xfunc_card_unreferenced(Query * queryInfo,
LispValue clause, Relid referenced)
{
Relid unreferenced,
allrelids = LispNil;
LispValue temp;
Relid unreferenced,
allrelids = LispNil;
LispValue temp;
/* find all relids of base relations referenced in query */
foreach(temp, queryInfo->base_relation_list_)
@ -766,11 +765,11 @@ xfunc_card_unreferenced(Query * queryInfo,
Count
xfunc_card_product(Query * queryInfo, Relid relids)
{
LispValue cinfonode;
LispValue temp;
Rel currel;
Cost tuples;
Count retval = 0;
LispValue cinfonode;
LispValue temp;
Rel currel;
Cost tuples;
Count retval = 0;
foreach(temp, relids)
{
@ -808,8 +807,8 @@ xfunc_card_product(Query * queryInfo, Relid relids)
List
xfunc_find_references(LispValue clause)
{
List retval = (List) LispNil;
LispValue tmpclause;
List retval = (List) LispNil;
LispValue tmpclause;
/* Base cases */
if (IsA(clause, Var))
@ -870,12 +869,12 @@ xfunc_find_references(LispValue clause)
LispValue
xfunc_primary_join(JoinPath pathnode)
{
LispValue joinclauselist = get_pathclauseinfo(pathnode);
CInfo mincinfo;
LispValue tmplist;
LispValue minclause = LispNil;
Cost minrank,
tmprank;
LispValue joinclauselist = get_pathclauseinfo(pathnode);
CInfo mincinfo;
LispValue tmplist;
LispValue minclause = LispNil;
Cost minrank,
tmprank;
if (IsA(pathnode, MergePath))
{
@ -932,9 +931,9 @@ xfunc_primary_join(JoinPath pathnode)
Cost
xfunc_get_path_cost(Query * queryInfo, Path pathnode)
{
Cost cost = 0;
LispValue tmplist;
Cost selec = 1.0;
Cost cost = 0;
LispValue tmplist;
Cost selec = 1.0;
/*
* * first add in the expensive local function costs. * We ensure that
@ -1025,12 +1024,12 @@ xfunc_get_path_cost(Query * queryInfo, Path pathnode)
Cost
xfunc_total_path_cost(JoinPath pathnode)
{
Cost cost = xfunc_get_path_cost((Path) pathnode);
Cost cost = xfunc_get_path_cost((Path) pathnode);
Assert(IsA(pathnode, JoinPath));
if (IsA(pathnode, MergePath))
{
MergePath mrgnode = (MergePath) pathnode;
MergePath mrgnode = (MergePath) pathnode;
cost += cost_mergesort(get_path_cost((Path) get_outerjoinpath(mrgnode)),
get_path_cost((Path) get_innerjoinpath(mrgnode)),
@ -1049,7 +1048,7 @@ xfunc_total_path_cost(JoinPath pathnode)
}
else if (IsA(pathnode, HashPath))
{
HashPath hashnode = (HashPath) pathnode;
HashPath hashnode = (HashPath) pathnode;
cost += cost_hashjoin(get_path_cost((Path) get_outerjoinpath(hashnode)),
get_path_cost((Path) get_innerjoinpath(hashnode)),
@ -1105,10 +1104,10 @@ xfunc_total_path_cost(JoinPath pathnode)
Cost
xfunc_expense_per_tuple(JoinPath joinnode, int whichchild)
{
Rel outerrel = get_parent((Path) get_outerjoinpath(joinnode));
Rel innerrel = get_parent((Path) get_innerjoinpath(joinnode));
Count outerwidth = get_width(outerrel);
Count outers_per_page = ceil(BLCKSZ / (outerwidth + sizeof(HeapTupleData)));
Rel outerrel = get_parent((Path) get_outerjoinpath(joinnode));
Rel innerrel = get_parent((Path) get_innerjoinpath(joinnode));
Count outerwidth = get_width(outerrel);
Count outers_per_page = ceil(BLCKSZ / (outerwidth + sizeof(HeapTupleData)));
if (IsA(joinnode, HashPath))
{
@ -1150,8 +1149,8 @@ xfunc_fixvars(LispValue clause, /* clause being pulled up */
Rel rel, /* rel it's being pulled from */
int varno) /* whether rel is INNER or OUTER of join */
{
LispValue tmpclause; /* temporary variable */
TargetEntry *tle; /* tlist member corresponding to var */
LispValue tmpclause; /* temporary variable */
TargetEntry *tle; /* tlist member corresponding to var */
if (IsA(clause, Const) || IsA(clause, Param))
@ -1205,11 +1204,11 @@ xfunc_fixvars(LispValue clause, /* clause being pulled up */
int
xfunc_cinfo_compare(void *arg1, void *arg2)
{
CInfo info1 = *(CInfo *) arg1;
CInfo info2 = *(CInfo *) arg2;
CInfo info1 = *(CInfo *) arg1;
CInfo info2 = *(CInfo *) arg2;
LispValue clause1 = (LispValue) get_clause(info1),
clause2 = (LispValue) get_clause(info2);
LispValue clause1 = (LispValue) get_clause(info1),
clause2 = (LispValue) get_clause(info2);
return (xfunc_clause_compare((void *) &clause1, (void *) &clause2));
}
@ -1222,10 +1221,10 @@ xfunc_cinfo_compare(void *arg1, void *arg2)
int
xfunc_clause_compare(void *arg1, void *arg2)
{
LispValue clause1 = *(LispValue *) arg1;
LispValue clause2 = *(LispValue *) arg2;
Cost rank1, /* total xfunc rank of clause1 */
rank2; /* total xfunc rank of clause2 */
LispValue clause1 = *(LispValue *) arg1;
LispValue clause2 = *(LispValue *) arg2;
Cost rank1, /* total xfunc rank of clause1 */
rank2; /* total xfunc rank of clause2 */
rank1 = xfunc_rank(clause1);
rank2 = xfunc_rank(clause2);
@ -1247,7 +1246,7 @@ xfunc_clause_compare(void *arg1, void *arg2)
void
xfunc_disjunct_sort(LispValue clause_list)
{
LispValue temp;
LispValue temp;
foreach(temp, clause_list)
if (or_clause(lfirst(temp)))
@ -1264,14 +1263,14 @@ xfunc_disjunct_sort(LispValue clause_list)
int
xfunc_disjunct_compare(Query * queryInfo, void *arg1, void *arg2)
{
LispValue disjunct1 = *(LispValue *) arg1;
LispValue disjunct2 = *(LispValue *) arg2;
Cost cost1, /* total cost of disjunct1 */
cost2, /* total cost of disjunct2 */
selec1,
selec2;
Cost rank1,
rank2;
LispValue disjunct1 = *(LispValue *) arg1;
LispValue disjunct2 = *(LispValue *) arg2;
Cost cost1, /* total cost of disjunct1 */
cost2, /* total cost of disjunct2 */
selec1,
selec2;
Cost rank1,
rank2;
cost1 = xfunc_expense(queryInfo, disjunct1);
cost2 = xfunc_expense(queryInfo, disjunct2);
@ -1310,12 +1309,12 @@ xfunc_disjunct_compare(Query * queryInfo, void *arg1, void *arg2)
int
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 */
LispValue tmpclause;
int retval;
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 */
LispValue tmpclause;
int retval;
/* lookup function and find its return type */
Assert(RegProcedureIsValid(funcid));
@ -1370,9 +1369,9 @@ exit:
int
xfunc_tuple_width(Relation rd)
{
int i;
int retval = 0;
TupleDesc tdesc = RelationGetTupleDescriptor(rd);
int i;
int retval = 0;
TupleDesc tdesc = RelationGetTupleDescriptor(rd);
for (i = 0; i < tdesc->natts; i++)
{
@ -1392,7 +1391,7 @@ xfunc_tuple_width(Relation rd)
int
xfunc_num_join_clauses(JoinPath path)
{
int num = length(get_pathclauseinfo(path));
int num = length(get_pathclauseinfo(path));
if (IsA(path, MergePath))
return (num + length(get_path_mergeclauses((MergePath) path)));
@ -1409,9 +1408,9 @@ xfunc_num_join_clauses(JoinPath path)
LispValue
xfunc_LispRemove(LispValue foo, List bar)
{
LispValue temp = LispNil;
LispValue result = LispNil;
int sanity = false;
LispValue temp = LispNil;
LispValue result = LispNil;
int sanity = false;
for (temp = bar; !null(temp); temp = lnext(temp))
if (!equal((Node) (foo), (Node) (lfirst(temp))))
@ -1439,7 +1438,7 @@ xfunc_LispRemove(LispValue foo, List bar)
bool
xfunc_copyrel(Rel from, Rel * to)
{
Rel newnode;
Rel newnode;
Pointer(*alloc) () = palloc;