1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +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/util/Attic/clauseinfo.c,v 1.4 1997/09/07 04:44:17 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/clauseinfo.c,v 1.5 1997/09/08 02:24:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,12 +44,12 @@ valid_or_clause(CInfo * clauseinfo)
* Returns a list containing the clauses from 'clauseinfo-list'.
*
*/
List *
List *
get_actual_clauses(List * clauseinfo_list)
{
List *temp = NIL;
List *result = NIL;
CInfo *clause = (CInfo *) NULL;
List *temp = NIL;
List *result = NIL;
CInfo *clause = (CInfo *) NULL;
foreach(temp, clauseinfo_list)
{
@@ -90,18 +90,18 @@ get_relattvals(List * clauseinfo_list,
List ** values,
List ** flags)
{
List *result1 = NIL;
List *result2 = NIL;
List *result3 = NIL;
CInfo *temp = (CInfo *) NULL;
List *i = NIL;
List *result1 = NIL;
List *result2 = NIL;
List *result3 = NIL;
CInfo *temp = (CInfo *) NULL;
List *i = NIL;
foreach(i, clauseinfo_list)
{
int dummy;
AttrNumber attno;
Datum constval;
int flag;
int dummy;
AttrNumber attno;
Datum constval;
int flag;
temp = (CInfo *) lfirst(i);
get_relattval((Node *) temp->clause, &dummy, &attno, &constval, &flag);
@@ -137,15 +137,15 @@ get_joinvars(Oid relid,
List ** values,
List ** flags)
{
List *result1 = NIL;
List *result2 = NIL;
List *result3 = NIL;
List *temp;
List *result1 = NIL;
List *result2 = NIL;
List *result3 = NIL;
List *temp;
foreach(temp, clauseinfo_list)
{
CInfo *clauseinfo = lfirst(temp);
Expr *clause = clauseinfo->clause;
CInfo *clauseinfo = lfirst(temp);
Expr *clause = clauseinfo->clause;
if (IsA(get_leftop(clause), Var) &&
(relid == (get_leftop(clause))->varno))
@@ -173,12 +173,12 @@ get_joinvars(Oid relid,
* of a list of clauseinfo nodes to be used with an index.
*
*/
List *
List *
get_opnos(List * clauseinfo_list)
{
CInfo *temp = (CInfo *) NULL;
List *result = NIL;
List *i = NIL;
CInfo *temp = (CInfo *) NULL;
List *result = NIL;
List *i = NIL;
foreach(i, clauseinfo_list)
{

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.8 1997/09/07 04:44:20 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.9 1997/09/08 02:24:52 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -34,16 +34,16 @@
#include "optimizer/internal.h"
#include "optimizer/var.h"
static bool agg_clause(Node * clause);
static bool agg_clause(Node * clause);
Expr *
Expr *
make_clause(int type, Node * oper, List * args)
{
if (type == AND_EXPR || type == OR_EXPR || type == NOT_EXPR ||
type == OP_EXPR || type == FUNC_EXPR)
{
Expr *expr = makeNode(Expr);
Expr *expr = makeNode(Expr);
/*
* assume type checking already done and we don't need the type of
@@ -92,10 +92,10 @@ is_opclause(Node * clause)
* operand (if it is non-null).
*
*/
Expr *
Expr *
make_opclause(Oper * op, Var * leftop, Var * rightop)
{
Expr *expr = makeNode(Expr);
Expr *expr = makeNode(Expr);
expr->typeOid = InvalidOid; /* assume type checking done */
expr->opType = OP_EXPR;
@@ -111,7 +111,7 @@ make_opclause(Oper * op, Var * leftop, Var * rightop)
* or (op expr)
* NB: it is assumed (for now) that all expr must be Var nodes
*/
Var *
Var *
get_leftop(Expr * clause)
{
if (clause->args != NULL)
@@ -126,7 +126,7 @@ get_leftop(Expr * clause)
* Returns the right operand in a clause of the form (op expr expr).
*
*/
Var *
Var *
get_rightop(Expr * clause)
{
if (clause->args != NULL && lnext(clause->args) != NULL)
@@ -139,7 +139,7 @@ get_rightop(Expr * clause)
* AGG clause functions
*****************************************************************************/
static bool
static bool
agg_clause(Node * clause)
{
return
@@ -171,10 +171,10 @@ is_funcclause(Node * clause)
* arguments.
*
*/
Expr *
Expr *
make_funcclause(Func * func, List * funcargs)
{
Expr *expr = makeNode(Expr);
Expr *expr = makeNode(Expr);
expr->typeOid = InvalidOid; /* assume type checking done */
expr->opType = FUNC_EXPR;
@@ -207,10 +207,10 @@ or_clause(Node * clause)
* Creates an 'or' clause given a list of its subclauses.
*
*/
Expr *
Expr *
make_orclause(List * orclauses)
{
Expr *expr = makeNode(Expr);
Expr *expr = makeNode(Expr);
expr->typeOid = InvalidOid; /* assume type checking done */
expr->opType = OR_EXPR;
@@ -243,10 +243,10 @@ not_clause(Node * clause)
* Create a 'not' clause given the expression to be negated.
*
*/
Expr *
Expr *
make_notclause(Expr * notclause)
{
Expr *expr = makeNode(Expr);
Expr *expr = makeNode(Expr);
expr->typeOid = InvalidOid; /* assume type checking done */
expr->opType = NOT_EXPR;
@@ -261,7 +261,7 @@ make_notclause(Expr * notclause)
* Retrieve the clause within a 'not' clause
*
*/
Expr *
Expr *
get_notclausearg(Expr * notclause)
{
return (lfirst(notclause->args));
@@ -292,10 +292,10 @@ and_clause(Node * clause)
* Create an 'and' clause given its arguments in a list.
*
*/
Expr *
Expr *
make_andclause(List * andclauses)
{
Expr *expr = makeNode(Expr);
Expr *expr = makeNode(Expr);
expr->typeOid = InvalidOid; /* assume type checking done */
expr->opType = AND_EXPR;
@@ -320,12 +320,12 @@ make_andclause(List * andclauses)
* quals as the return value.
*
*/
List *
List *
pull_constant_clauses(List * quals, List ** constantQual)
{
List *q;
List *constqual = NIL;
List *restqual = NIL;
List *q;
List *constqual = NIL;
List *restqual = NIL;
foreach(q, quals)
{
@@ -358,15 +358,15 @@ pull_constant_clauses(List * quals, List ** constantQual)
void
clause_relids_vars(Node * clause, List ** relids, List ** vars)
{
List *clvars = pull_var_clause(clause);
List *var_list = NIL;
List *varno_list = NIL;
List *i = NIL;
List *clvars = pull_var_clause(clause);
List *var_list = NIL;
List *varno_list = NIL;
List *i = NIL;
foreach(i, clvars)
{
Var *var = (Var *) lfirst(i);
List *vi;
Var *var = (Var *) lfirst(i);
List *vi;
if (!intMember(var->varno, varno_list))
{
@@ -374,7 +374,7 @@ clause_relids_vars(Node * clause, List ** relids, List ** vars)
}
foreach(vi, var_list)
{
Var *in_list = (Var *) lfirst(vi);
Var *in_list = (Var *) lfirst(vi);
if (in_list->varno == var->varno &&
in_list->varattno == var->varattno)
@@ -398,13 +398,13 @@ clause_relids_vars(Node * clause, List ** relids, List ** vars)
int
NumRelids(Node * clause)
{
List *vars = pull_var_clause(clause);
List *i = NIL;
List *var_list = NIL;
List *vars = pull_var_clause(clause);
List *i = NIL;
List *var_list = NIL;
foreach(i, vars)
{
Var *var = (Var *) lfirst(i);
Var *var = (Var *) lfirst(i);
if (!intMember(var->varno, var_list))
{
@@ -433,7 +433,7 @@ contains_not(Node * clause)
if (or_clause(clause))
{
List *a;
List *a;
foreach(a, ((Expr *) clause)->args)
{
@@ -454,8 +454,8 @@ contains_not(Node * clause)
bool
join_clause_p(Node * clause)
{
Node *leftop,
*rightop;
Node *leftop,
*rightop;
if (!is_opclause(clause))
return false;
@@ -528,7 +528,7 @@ fix_opid(Node * clause)
}
else if (IsA(clause, ArrayRef))
{
ArrayRef *aref = (ArrayRef *) clause;
ArrayRef *aref = (ArrayRef *) clause;
fix_opids(aref->refupperindexpr);
fix_opids(aref->reflowerindexpr);
@@ -559,10 +559,10 @@ fix_opid(Node * clause)
* Returns its argument.
*
*/
List *
List *
fix_opids(List * clauses)
{
List *clause;
List *clause;
foreach(clause, clauses)
fix_opid(lfirst(clause));
@@ -601,8 +601,8 @@ get_relattval(Node * clause,
Datum * constval,
int *flag)
{
Var *left = get_leftop((Expr *) clause);
Var *right = get_rightop((Expr *) clause);
Var *left = get_leftop((Expr *) clause);
Var *right = get_rightop((Expr *) clause);
if (is_opclause(clause) && IsA(left, Var) &&
IsA(right, Const))
@@ -641,7 +641,7 @@ get_relattval(Node * clause,
is_funcclause((Node *) left) &&
IsA(right, Const))
{
List *args = ((Expr *) left)->args;
List *args = ((Expr *) left)->args;
*relid = ((Var *) lfirst(args))->varno;
@@ -662,7 +662,7 @@ get_relattval(Node * clause,
is_funcclause((Node *) right) &&
IsA(left, Const))
{
List *args = ((Expr *) right)->args;
List *args = ((Expr *) right)->args;
*relid = ((Var *) lfirst(args))->varno;
*attno = InvalidAttrNumber;
@@ -732,13 +732,13 @@ get_rels_atts(Node * clause,
int *relid2,
AttrNumber * attno2)
{
Var *left = get_leftop((Expr *) clause);
Var *right = get_rightop((Expr *) clause);
bool var_left = (IsA(left, Var));
bool var_right = (IsA(right, Var));
bool varexpr_left = (bool) ((IsA(left, Func) || IsA(left, Oper)) &&
contain_var_clause((Node *) left));
bool varexpr_right = (bool) ((IsA(right, Func) || IsA(right, Oper)) &&
Var *left = get_leftop((Expr *) clause);
Var *right = get_rightop((Expr *) clause);
bool var_left = (IsA(left, Var));
bool var_right = (IsA(right, Var));
bool varexpr_left = (bool) ((IsA(left, Func) || IsA(left, Oper)) &&
contain_var_clause((Node *) left));
bool varexpr_right = (bool) ((IsA(right, Func) || IsA(right, Oper)) &&
contain_var_clause((Node *) right));
if (is_opclause(clause))
@@ -782,10 +782,10 @@ get_rels_atts(Node * clause,
void
CommuteClause(Node * clause)
{
Node *temp;
Oper *commu;
Node *temp;
Oper *commu;
OperatorTupleForm commuTup;
HeapTuple heapTup;
HeapTuple heapTup;
if (!is_opclause(clause))
return;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.3 1997/09/07 04:44:22 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.4 1997/09/08 02:24:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,7 +24,7 @@
#include "optimizer/pathnode.h" /* where the decls go */
static List *find_secondary_index(Query * root, Oid relid);
static List *find_secondary_index(Query * root, Oid relid);
/*
* find-relation-indices--
@@ -32,7 +32,7 @@ static List *find_secondary_index(Query * root, Oid relid);
* each (secondary) index defined on a relation.
*
*/
List *
List *
find_relation_indices(Query * root, Rel * rel)
{
if (rel->indexed)
@@ -56,16 +56,16 @@ find_relation_indices(Query * root, Rel * rel)
* Returns a list of new index nodes.
*
*/
static List *
static List *
find_secondary_index(Query * root, Oid relid)
{
IdxInfoRetval indexinfo;
List *indexes = NIL;
bool first = TRUE;
IdxInfoRetval indexinfo;
List *indexes = NIL;
bool first = TRUE;
while (index_info(root, first, relid, &indexinfo))
{
Rel *indexnode = makeNode(Rel);
Rel *indexnode = makeNode(Rel);
indexnode->relids = lconsi(indexinfo.relid, NIL);
indexnode->relam = indexinfo.relam;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/internal.c,v 1.4 1997/09/07 04:44:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/internal.c,v 1.5 1997/09/08 02:24:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,17 +38,17 @@
/* the following should probably be moved elsewhere -ay */
TargetEntry *
TargetEntry *
MakeTLE(Resdom * resdom, Node * expr)
{
TargetEntry *rt = makeNode(TargetEntry);
TargetEntry *rt = makeNode(TargetEntry);
rt->resdom = resdom;
rt->expr = expr;
return rt;
}
Var *
Var *
get_expr(TargetEntry * tle)
{
Assert(tle != NULL);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.3 1997/09/07 04:44:27 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.4 1997/09/08 02:24:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,11 +35,11 @@
* exists.
*
*/
JInfo *
JInfo *
joininfo_member(List * join_relids, List * joininfo_list)
{
List *i = NIL;
List *other_rels = NIL;
List *i = NIL;
List *other_rels = NIL;
foreach(i, joininfo_list)
{
@@ -61,11 +61,11 @@ joininfo_member(List * join_relids, List * joininfo_list)
* Returns a joininfo node.
*
*/
JInfo *
JInfo *
find_joininfo_node(Rel * this_rel, List * join_relids)
{
JInfo *joininfo = joininfo_member(join_relids,
this_rel->joininfo);
JInfo *joininfo = joininfo_member(join_relids,
this_rel->joininfo);
if (joininfo == NULL)
{
@@ -88,12 +88,12 @@ find_joininfo_node(Rel * this_rel, List * join_relids)
* Returns the other var node in the joinclause if it is, nil if not.
*
*/
Var *
Var *
other_join_clause_var(Var * var, Expr * clause)
{
Var *retval;
Var *l,
*r;
Var *retval;
Var *l,
*r;
retval = (Var *) NULL;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.3 1997/09/07 04:44:28 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.4 1997/09/08 02:24:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,8 +22,8 @@
#include "optimizer/tlist.h"
static Expr *matching2_tlvar(int var, List * tlist, bool(*test) ());
static bool equal_indexkey_var(int index_key, Var * var);
static Expr *matching2_tlvar(int var, List * tlist, bool(*test) ());
static bool equal_indexkey_var(int index_key, Var * var);
/*
* 1. index key
@@ -70,7 +70,7 @@ match_indexkey_operand(int indexkey, Var * operand, Rel * rel)
* fields of var node 'var'.
*
*/
static bool
static bool
equal_indexkey_var(int index_key, Var * var)
{
if (index_key == var->varattno)
@@ -85,22 +85,22 @@ equal_indexkey_var(int index_key, Var * var)
* lelation.
*
*/
Var *
Var *
extract_subkey(JoinKey * jk, int which_subkey)
{
Var *retval;
Var *retval;
switch (which_subkey)
{
case OUTER:
retval = jk->outer;
break;
case INNER:
retval = jk->inner;
break;
default: /* do nothing */
elog(DEBUG, "extract_subkey with neither INNER or OUTER");
retval = NULL;
case OUTER:
retval = jk->outer;
break;
case INNER:
retval = jk->inner;
break;
default: /* do nothing */
elog(DEBUG, "extract_subkey with neither INNER or OUTER");
retval = NULL;
}
return (retval);
}
@@ -120,9 +120,9 @@ extract_subkey(JoinKey * jk, int which_subkey)
bool
samekeys(List * keys1, List * keys2)
{
bool allmember = true;
List *key1,
*key2;
bool allmember = true;
List *key1,
*key2;
for (key1 = keys1, key2 = keys2; key1 != NIL && key2 != NIL;
key1 = lnext(key1), key2 = lnext(key2))
@@ -152,14 +152,14 @@ samekeys(List * keys1, List * keys2)
/* This function is identical to matching_tlvar and tlistentry_member.
* They should be merged.
*/
static Expr *
static Expr *
matching2_tlvar(int var, List * tlist, bool(*test) ())
{
TargetEntry *tlentry = NULL;
TargetEntry *tlentry = NULL;
if (var)
{
List *temp;
List *temp;
foreach(temp, tlist)
{
@@ -178,16 +178,16 @@ matching2_tlvar(int var, List * tlist, bool(*test) ())
}
List *
List *
collect_index_pathkeys(int *index_keys, List * tlist)
{
List *retval = NIL;
List *retval = NIL;
Assert(index_keys != NULL);
while (index_keys[0] != 0)
{
Expr *mvar;
Expr *mvar;
mvar = matching2_tlvar(index_keys[0],
tlist,

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/ordering.c,v 1.4 1997/09/07 04:44:30 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/ordering.c,v 1.5 1997/09/08 02:24:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,7 +18,7 @@
#include "optimizer/internal.h"
#include "optimizer/ordering.h"
static bool equal_sortops_order(Oid * ordering1, Oid * ordering2);
static bool equal_sortops_order(Oid * ordering1, Oid * ordering2);
/*
* equal-path-path-ordering--
@@ -110,10 +110,10 @@ equal_merge_merge_ordering(MergeOrder * merge_ordering1,
* equal_sort_ops_order -
* Returns true iff the sort operators are in the same order.
*/
static bool
static bool
equal_sortops_order(Oid * ordering1, Oid * ordering2)
{
int i = 0;
int i = 0;
if (ordering1 == NULL || ordering2 == NULL)
return (ordering1 == ordering2);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.4 1997/09/07 04:44:30 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.5 1997/09/08 02:24:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,7 +29,7 @@
#include "parser/parsetree.h" /* for getrelid() */
static Path *better_path(Path * new_path, List * unique_paths, bool * noOther);
static Path *better_path(Path * new_path, List * unique_paths, bool * noOther);
/*****************************************************************************
@@ -44,8 +44,8 @@ static Path *better_path(Path * new_path, List * unique_paths, bool * noOther
bool
path_is_cheaper(Path * path1, Path * path2)
{
Cost cost1 = path1->path_cost;
Cost cost2 = path2->path_cost;
Cost cost1 = path1->path_cost;
Cost cost2 = path2->path_cost;
return ((bool) (cost1 < cost2));
}
@@ -61,11 +61,11 @@ path_is_cheaper(Path * path1, Path * path2)
* is minimum.
*
*/
Path *
Path *
set_cheapest(Rel * parent_rel, List * pathlist)
{
List *p;
Path *cheapest_so_far;
List *p;
Path *cheapest_so_far;
Assert(pathlist != NIL);
Assert(IsA(parent_rel, Rel));
@@ -74,7 +74,7 @@ set_cheapest(Rel * parent_rel, List * pathlist)
foreach(p, lnext(pathlist))
{
Path *path = (Path *) lfirst(p);
Path *path = (Path *) lfirst(p);
if (path_is_cheaper(path, cheapest_so_far))
{
@@ -100,13 +100,13 @@ set_cheapest(Rel * parent_rel, List * pathlist)
* Returns the list of unique pathnodes.
*
*/
List *
List *
add_pathlist(Rel * parent_rel, List * unique_paths, List * new_paths)
{
List *x;
Path *new_path;
Path *old_path;
bool noOther;
List *x;
Path *new_path;
Path *old_path;
bool noOther;
foreach(x, new_paths)
{
@@ -153,13 +153,13 @@ add_pathlist(Rel * parent_rel, List * unique_paths, List * new_paths)
* t - if there is no path in the list with the same ordering and keys
*
*/
static Path *
static Path *
better_path(Path * new_path, List * unique_paths, bool * noOther)
{
Path *old_path = (Path *) NULL;
Path *path = (Path *) NULL;
List *temp = NIL;
Path *retval = NULL;
Path *old_path = (Path *) NULL;
Path *path = (Path *) NULL;
List *temp = NIL;
Path *retval = NULL;
/*
* XXX - added the following two lines which weren't int the lisp
@@ -207,12 +207,12 @@ better_path(Path * new_path, List * unique_paths, bool * noOther)
* pathnode.
*
*/
Path *
Path *
create_seqscan_path(Rel * rel)
{
int relid = 0;
int relid = 0;
Path *pathnode = makeNode(Path);
Path *pathnode = makeNode(Path);
pathnode->pathtype = T_SeqScan;
pathnode->parent = rel;
@@ -257,14 +257,14 @@ create_seqscan_path(Rel * rel)
* Returns the new path node.
*
*/
IndexPath *
IndexPath *
create_index_path(Query * root,
Rel * rel,
Rel * index,
List * restriction_clauses,
bool is_join_scan)
{
IndexPath *pathnode = makeNode(IndexPath);
IndexPath *pathnode = makeNode(IndexPath);
pathnode->path.pathtype = T_IndexScan;
pathnode->path.parent = rel;
@@ -344,12 +344,12 @@ create_index_path(Query * root,
* Compute scan cost for the case when 'index' is used with a
* restriction clause.
*/
List *attnos;
List *values;
List *flags;
float npages;
float selec;
Cost clausesel;
List *attnos;
List *values;
List *flags;
float npages;
float selec;
Cost clausesel;
get_relattvals(restriction_clauses,
&attnos,
@@ -417,14 +417,14 @@ create_index_path(Query * root,
* Returns the resulting path node.
*
*/
JoinPath *
JoinPath *
create_nestloop_path(Rel * joinrel,
Rel * outer_rel,
Path * outer_path,
Path * inner_path,
List * keys)
{
JoinPath *pathnode = makeNode(JoinPath);
JoinPath *pathnode = makeNode(JoinPath);
pathnode->path.pathtype = T_NestLoop;
pathnode->path.parent = joinrel;
@@ -494,7 +494,7 @@ create_nestloop_path(Rel * joinrel,
* 'innersortkeys' are the sort varkeys for the inner relation
*
*/
MergePath *
MergePath *
create_mergesort_path(Rel * joinrel,
int outersize,
int innersize,
@@ -508,7 +508,7 @@ create_mergesort_path(Rel * joinrel,
List * outersortkeys,
List * innersortkeys)
{
MergePath *pathnode = makeNode(MergePath);
MergePath *pathnode = makeNode(MergePath);
pathnode->jpath.path.pathtype = T_MergeJoin;
pathnode->jpath.path.parent = joinrel;
@@ -560,7 +560,7 @@ create_mergesort_path(Rel * joinrel,
* 'innerkeys' are the sort varkeys for the inner relation
*
*/
HashPath *
HashPath *
create_hashjoin_path(Rel * joinrel,
int outersize,
int innersize,
@@ -574,7 +574,7 @@ create_hashjoin_path(Rel * joinrel,
List * outerkeys,
List * innerkeys)
{
HashPath *pathnode = makeNode(HashPath);
HashPath *pathnode = makeNode(HashPath);
pathnode->jpath.path.pathtype = T_HashJoin;
pathnode->jpath.path.parent = joinrel;

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.7 1997/09/07 04:44:31 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.8 1997/09/08 02:25:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -59,9 +59,9 @@ void
relation_info(Query * root, Index relid,
bool * hasindex, int *pages, int *tuples)
{
HeapTuple relationTuple;
Form_pg_class relation;
Oid relationObjectId;
HeapTuple relationTuple;
Form_pg_class relation;
Oid relationObjectId;
relationObjectId = getrelid(relid, root->rtable);
relationTuple = SearchSysCacheTuple(RELOID,
@@ -103,14 +103,14 @@ relation_info(Query * root, Index relid,
bool
index_info(Query * root, bool first, int relid, IdxInfoRetval * info)
{
register i;
HeapTuple indexTuple,
amopTuple;
IndexTupleForm index;
Relation indexRelation;
uint16 amstrategy;
Oid relam;
Oid indrelid;
register i;
HeapTuple indexTuple,
amopTuple;
IndexTupleForm index;
Relation indexRelation;
uint16 amstrategy;
Oid relam;
Oid indrelid;
static Relation relation = (Relation) NULL;
static HeapScanDesc scan = (HeapScanDesc) NULL;
@@ -183,7 +183,7 @@ index_info(Query * root, bool first, int relid, IdxInfoRetval * info)
* which is all within a command, so the automatic pfree at end of
* transaction should be ok.
*/
char *predString;
char *predString;
predString = fmgr(F_TEXTOUT, &index->indpred);
info->indpred = (Node *) stringToNode(predString);
@@ -256,15 +256,15 @@ index_selectivity(Oid indid,
float *idxPages,
float *idxSelec)
{
Oid *opno_array;
int *attno_array,
*flag_array;
char **value_array;
int i = 0;
List *xopno,
*xattno,
*value,
*flag;
Oid *opno_array;
int *attno_array,
*flag_array;
char **value_array;
int i = 0;
List *xopno,
*xattno,
*value,
*flag;
if (length(opnos) != nkeys || length(attnos) != nkeys ||
length(values) != nkeys || length(flags) != nkeys)
@@ -339,7 +339,7 @@ restriction_selectivity(Oid functionObjectId,
char *constValue,
int32 constFlag)
{
float64 result;
float64 result;
result = (float64) fmgr(functionObjectId,
(char *) operatorObjectId,
@@ -378,7 +378,7 @@ join_selectivity(Oid functionObjectId,
Oid relationObjectId2,
AttrNumber attributeNumber2)
{
float64 result;
float64 result;
result = (float64) fmgr(functionObjectId,
(char *) operatorObjectId,
@@ -403,18 +403,18 @@ join_selectivity(Oid functionObjectId,
* Returns a LISP list containing the OIDs of all relations which
* inherits from the relation with OID 'inhparent'.
*/
List *
List *
find_inheritance_children(Oid inhparent)
{
static ScanKeyData key[1] = {
{0, Anum_pg_inherits_inhparent, F_OIDEQ}
};
HeapTuple inheritsTuple;
Relation relation;
HeapScanDesc scan;
List *list = NIL;
Oid inhrelid;
HeapTuple inheritsTuple;
Relation relation;
HeapScanDesc scan;
List *list = NIL;
Oid inhrelid;
fmgr_info(F_OIDEQ, &key[0].sk_func, &key[0].sk_nargs);
@@ -439,18 +439,18 @@ find_inheritance_children(Oid inhparent)
* Returns a LISP list containing the OIDs of all relations which are
* base relations of the relation with OID 'verrelid'.
*/
List *
List *
VersionGetParents(Oid verrelid)
{
static ScanKeyData key[1] = {
{0, Anum_pg_version_verrelid, F_OIDEQ}
};
HeapTuple versionTuple;
Relation relation;
HeapScanDesc scan;
Oid verbaseid;
List *list = NIL;
HeapTuple versionTuple;
Relation relation;
HeapScanDesc scan;
Oid verbaseid;
List *list = NIL;
fmgr_info(F_OIDEQ, &key[0].sk_func, &key[0].sk_nargs);
relation = heap_openr(VersionRelationName);
@@ -512,21 +512,21 @@ IndexSelectivity(Oid indexrelid,
float *idxPages,
float *idxSelec)
{
register i,
n;
HeapTuple indexTuple,
amopTuple,
indRel;
IndexTupleForm index;
Form_pg_amop amop;
Oid indclass;
float64data npages,
select;
float64 amopnpages,
amopselect;
Oid relam;
bool nphack = false;
float64data fattr_select = 1.0;
register i,
n;
HeapTuple indexTuple,
amopTuple,
indRel;
IndexTupleForm index;
Form_pg_amop amop;
Oid indclass;
float64data npages,
select;
float64 amopnpages,
amopselect;
Oid relam;
bool nphack = false;
float64data fattr_select = 1.0;
indRel = SearchSysCacheTuple(RELOID,
ObjectIdGetDatum(indexrelid),

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.2 1997/09/07 04:44:32 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.3 1997/09/08 02:25:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,11 +27,11 @@
* necessary. This is for base relations.
*
*/
Rel *
Rel *
get_base_rel(Query * root, int relid)
{
List *relids;
Rel *rel;
List *relids;
Rel *rel;
relids = lconsi(relid, NIL);
rel = rel_member(relids, root->base_relation_list_);
@@ -77,9 +77,9 @@ get_base_rel(Query * root, int relid)
}
else
{
bool hasindex;
int pages,
tuples;
bool hasindex;
int pages,
tuples;
/*
* Otherwise, retrieve relation characteristics from the
@@ -100,7 +100,7 @@ get_base_rel(Query * root, int relid)
* creating a new one if necessary. This is for join relations.
*
*/
Rel *
Rel *
get_join_rel(Query * root, List * relid)
{
return rel_member(relid, root->join_relation_list_);
@@ -114,11 +114,11 @@ get_join_rel(Query * root, List * relid)
* Returns the corresponding entry in 'rels' if it is there.
*
*/
Rel *
Rel *
rel_member(List * relid, List * rels)
{
List *temp = NIL;
List *temprelid = NIL;
List *temp = NIL;
List *temprelid = NIL;
if (relid != NIL && rels != NIL)
{

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.5 1997/09/07 04:44:33 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.6 1997/09/08 02:25:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,7 +28,7 @@
#include "nodes/makefuncs.h"
#include "parser/catalog_utils.h"
static Node *flatten_tlistentry(Node * tlistentry, List * flat_tlist);
static Node *flatten_tlistentry(Node * tlistentry, List * flat_tlist);
/*****************************************************************************
* ---------- RELATION node target list routines ----------
@@ -44,12 +44,12 @@ static Node *flatten_tlistentry(Node * tlistentry, List * flat_tlist);
* var = valid var-node
* targetlist = valid sequence
*/
TargetEntry *
TargetEntry *
tlistentry_member(Var * var, List * targetlist)
{
if (var)
{
List *temp = NIL;
List *temp = NIL;
foreach(temp, targetlist)
{
@@ -69,10 +69,10 @@ tlistentry_member(Var * var, List * targetlist)
* REQUIRES: "test" operates on lispval unions,
*
*/
Expr *
Expr *
matching_tlvar(Var * var, List * targetlist)
{
TargetEntry *tlentry;
TargetEntry *tlentry;
tlentry = tlistentry_member(var, targetlist);
if (tlentry)
@@ -96,7 +96,7 @@ matching_tlvar(Var * var, List * targetlist)
void
add_tl_element(Rel * rel, Var * var)
{
Expr *oldvar = (Expr *) NULL;
Expr *oldvar = (Expr *) NULL;
oldvar = matching_tlvar(var, rel->targetlist);
@@ -105,12 +105,12 @@ add_tl_element(Rel * rel, Var * var)
*/
if (oldvar == NULL)
{
List *tlist = rel->targetlist;
Var *newvar = makeVar(var->varno,
var->varattno,
var->vartype,
var->varno,
var->varoattno);
List *tlist = rel->targetlist;
Var *newvar = makeVar(var->varno,
var->varattno,
var->vartype,
var->varno,
var->varoattno);
rel->targetlist =
lappend(tlist,
@@ -129,10 +129,10 @@ add_tl_element(Rel * rel, Var * var)
* RETURNS: newly created tlist-entry
* CREATES: new targetlist entry (always).
*/
TargetEntry *
TargetEntry *
create_tl_element(Var * var, int resdomno)
{
TargetEntry *tlelement = makeNode(TargetEntry);
TargetEntry *tlelement = makeNode(TargetEntry);
tlelement->resdom =
makeResdom(resdomno,
@@ -152,7 +152,7 @@ create_tl_element(Var * var, int resdomno)
* Returns the targetlist elements from a relation tlist.
*
*/
List *
List *
get_actual_tlist(List * tlist)
{
@@ -160,8 +160,8 @@ get_actual_tlist(List * tlist)
* this function is not making sense. - ay 10/94
*/
#if 0
List *element = NIL;
List *result = NIL;
List *element = NIL;
List *result = NIL;
if (tlist == NULL)
{
@@ -199,12 +199,12 @@ get_actual_tlist(List * tlist)
* Returns the resdom entry of the matching var node.
*
*/
Resdom *
Resdom *
tlist_member(Var * var, List * tlist)
{
List *i = NIL;
TargetEntry *temp_tle = (TargetEntry *) NULL;
TargetEntry *tl_elt = (TargetEntry *) NULL;
List *i = NIL;
TargetEntry *temp_tle = (TargetEntry *) NULL;
TargetEntry *tl_elt = (TargetEntry *) NULL;
if (var)
{
@@ -229,12 +229,12 @@ tlist_member(Var * var, List * tlist)
/*
* Routine to get the resdom out of a targetlist.
*/
Resdom *
Resdom *
tlist_resdom(List * tlist, Resdom * resnode)
{
Resdom *resdom = (Resdom *) NULL;
List *i = NIL;
TargetEntry *temp_tle = (TargetEntry *) NULL;
Resdom *resdom = (Resdom *) NULL;
List *i = NIL;
TargetEntry *temp_tle = (TargetEntry *) NULL;
foreach(i, tlist)
{
@@ -264,18 +264,18 @@ tlist_resdom(List * tlist, Resdom * resnode)
* [what used to be varid is now broken up into two fields varnoold and
* varoattno. Also, nested attnos are long gone. - ay 2/95]
*/
TargetEntry *
TargetEntry *
match_varid(Var * test_var, List * tlist)
{
List *tl;
Oid type_var;
List *tl;
Oid type_var;
type_var = (Oid) test_var->vartype;
foreach(tl, tlist)
{
TargetEntry *entry;
Var *tlvar;
TargetEntry *entry;
Var *tlvar;
entry = lfirst(tl);
tlvar = get_expr(entry);
@@ -310,15 +310,15 @@ match_varid(Var * test_var, List * tlist)
* Returns the resulting target list.
*
*/
List *
List *
new_unsorted_tlist(List * targetlist)
{
List *new_targetlist = (List *) copyObject((Node *) targetlist);
List *x = NIL;
List *new_targetlist = (List *) copyObject((Node *) targetlist);
List *x = NIL;
foreach(x, new_targetlist)
{
TargetEntry *tle = (TargetEntry *) lfirst(x);
TargetEntry *tle = (TargetEntry *) lfirst(x);
tle->resdom->reskey = 0;
tle->resdom->reskeyop = (Oid) 0;
@@ -338,18 +338,18 @@ new_unsorted_tlist(List * targetlist)
* Returns a new target list.
*
*/
List *
List *
copy_vars(List * target, List * source)
{
List *result = NIL;
List *src = NIL;
List *dest = NIL;
List *result = NIL;
List *src = NIL;
List *dest = NIL;
for (src = source, dest = target; src != NIL &&
dest != NIL; src = lnext(src), dest = lnext(dest))
{
TargetEntry *temp = MakeTLE(((TargetEntry *) lfirst(dest))->resdom,
(Node *) get_expr(lfirst(src)));
TargetEntry *temp = MakeTLE(((TargetEntry *) lfirst(dest))->resdom,
(Node *) get_expr(lfirst(src)));
result = lappend(result, temp);
}
@@ -366,18 +366,18 @@ copy_vars(List * target, List * source)
* Returns the "flattened" new target list.
*
*/
List *
List *
flatten_tlist(List * tlist)
{
int last_resdomno = 1;
List *new_tlist = NIL;
List *tlist_vars = NIL;
List *temp;
int last_resdomno = 1;
List *new_tlist = NIL;
List *tlist_vars = NIL;
List *temp;
foreach(temp, tlist)
{
TargetEntry *temp_entry = NULL;
List *vars;
TargetEntry *temp_entry = NULL;
List *vars;
temp_entry = lfirst(temp);
vars = pull_var_clause((Node *) get_expr(temp_entry));
@@ -389,11 +389,11 @@ flatten_tlist(List * tlist)
foreach(temp, tlist_vars)
{
Var *var = lfirst(temp);
Var *var = lfirst(temp);
if (!(tlist_member(var, new_tlist)))
{
Resdom *r;
Resdom *r;
r = makeResdom(last_resdomno,
var->vartype,
@@ -422,15 +422,15 @@ flatten_tlist(List * tlist)
* Returns the modified actual target list.
*
*/
List *
List *
flatten_tlist_vars(List * full_tlist, List * flat_tlist)
{
List *x = NIL;
List *result = NIL;
List *x = NIL;
List *result = NIL;
foreach(x, full_tlist)
{
TargetEntry *tle = lfirst(x);
TargetEntry *tle = lfirst(x);
result =
lappend(result,
@@ -453,7 +453,7 @@ flatten_tlist_vars(List * full_tlist, List * flat_tlist)
* Returns the (modified) target_list entry from the target list.
*
*/
static Node *
static Node *
flatten_tlistentry(Node * tlistentry, List * flat_tlist)
{
if (tlistentry == NULL)
@@ -486,9 +486,9 @@ flatten_tlistentry(Node * tlistentry, List * flat_tlist)
}
else if (is_funcclause(tlistentry))
{
Expr *expr = (Expr *) tlistentry;
List *temp_result = NIL;
List *elt = NIL;
Expr *expr = (Expr *) tlistentry;
List *temp_result = NIL;
List *elt = NIL;
foreach(elt, expr->args)
temp_result = lappend(temp_result,
@@ -506,9 +506,9 @@ flatten_tlistentry(Node * tlistentry, List * flat_tlist)
}
else if (IsA(tlistentry, ArrayRef))
{
ArrayRef *aref = (ArrayRef *) tlistentry;
List *temp = NIL;
List *elt = NIL;
ArrayRef *aref = (ArrayRef *) tlistentry;
List *temp = NIL;
List *elt = NIL;
foreach(elt, aref->refupperindexpr)
temp = lappend(temp, flatten_tlistentry(lfirst(elt), flat_tlist));
@@ -529,11 +529,11 @@ flatten_tlistentry(Node * tlistentry, List * flat_tlist)
}
else
{
Expr *expr = (Expr *) tlistentry;
Var *left =
Expr *expr = (Expr *) tlistentry;
Var *left =
(Var *) flatten_tlistentry((Node *) get_leftop(expr),
flat_tlist);
Var *right =
Var *right =
(Var *) flatten_tlistentry((Node *) get_rightop(expr),
flat_tlist);
@@ -543,17 +543,17 @@ flatten_tlistentry(Node * tlistentry, List * flat_tlist)
}
TargetEntry *
TargetEntry *
MakeTLE(Resdom * resdom, Node * expr)
{
TargetEntry *rt = makeNode(TargetEntry);
TargetEntry *rt = makeNode(TargetEntry);
rt->resdom = resdom;
rt->expr = expr;
return rt;
}
Var *
Var *
get_expr(TargetEntry * tle)
{
Assert(tle != NULL);
@@ -576,17 +576,17 @@ get_expr(TargetEntry * tle)
void
AddGroupAttrToTlist(List * tlist, List * grpCl)
{
List *gl;
int last_resdomno = length(tlist) + 1;
List *gl;
int last_resdomno = length(tlist) + 1;
foreach(gl, grpCl)
{
GroupClause *gc = (GroupClause *) lfirst(gl);
Var *var = gc->grpAttr;
GroupClause *gc = (GroupClause *) lfirst(gl);
Var *var = gc->grpAttr;
if (!(tlist_member(var, tlist)))
{
Resdom *r;
Resdom *r;
r = makeResdom(last_resdomno,
var->vartype,
@@ -608,9 +608,9 @@ AddGroupAttrToTlist(List * tlist, List * grpCl)
int
exec_tlist_length(List * targetlist)
{
int len;
List *tl;
TargetEntry *curTle;
int len;
List *tl;
TargetEntry *curTle;
len = 0;
foreach(tl, targetlist)

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.4 1997/09/07 04:44:35 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.5 1997/09/08 02:25:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,35 +34,35 @@
* XXX assumes varno's are always integers, which shouldn't be true...
* (though it currently is, see primnodes.h)
*/
List *
List *
pull_varnos(Node * me)
{
List *i,
*result = NIL;
List *i,
*result = NIL;
if (me == NULL)
return (NIL);
switch (nodeTag(me))
{
case T_List:
foreach(i, (List *) me)
{
result = nconc(result, pull_varnos(lfirst(i)));
}
break;
case T_ArrayRef:
foreach(i, ((ArrayRef *) me)->refupperindexpr)
result = nconc(result, pull_varnos(lfirst(i)));
foreach(i, ((ArrayRef *) me)->reflowerindexpr)
result = nconc(result, pull_varnos(lfirst(i)));
result = nconc(result, pull_varnos(((ArrayRef *) me)->refassgnexpr));
break;
case T_Var:
result = lconsi(((Var *) me)->varno, NIL);
break;
default:
break;
case T_List:
foreach(i, (List *) me)
{
result = nconc(result, pull_varnos(lfirst(i)));
}
break;
case T_ArrayRef:
foreach(i, ((ArrayRef *) me)->refupperindexpr)
result = nconc(result, pull_varnos(lfirst(i)));
foreach(i, ((ArrayRef *) me)->reflowerindexpr)
result = nconc(result, pull_varnos(lfirst(i)));
result = nconc(result, pull_varnos(((ArrayRef *) me)->refassgnexpr));
break;
case T_Var:
result = lconsi(((Var *) me)->varno, NIL);
break;
default:
break;
}
return (result);
}
@@ -87,7 +87,7 @@ contain_var_clause(Node * clause)
return FALSE;
else if (or_clause(clause))
{
List *temp;
List *temp;
foreach(temp, ((Expr *) clause)->args)
{
@@ -98,7 +98,7 @@ contain_var_clause(Node * clause)
}
else if (is_funcclause(clause))
{
List *temp;
List *temp;
foreach(temp, ((Expr *) clause)->args)
{
@@ -109,7 +109,7 @@ contain_var_clause(Node * clause)
}
else if (IsA(clause, ArrayRef))
{
List *temp;
List *temp;
foreach(temp, ((ArrayRef *) clause)->refupperindexpr)
{
@@ -143,10 +143,10 @@ contain_var_clause(Node * clause)
*
* Returns list of varnodes found.
*/
List *
List *
pull_var_clause(Node * clause)
{
List *retval = NIL;
List *retval = NIL;
if (clause == NULL)
return (NIL);
@@ -158,14 +158,14 @@ pull_var_clause(Node * clause)
retval = NIL;
else if (or_clause(clause))
{
List *temp;
List *temp;
foreach(temp, ((Expr *) clause)->args)
retval = nconc(retval, pull_var_clause(lfirst(temp)));
}
else if (is_funcclause(clause))
{
List *temp;
List *temp;
foreach(temp, ((Expr *) clause)->args)
retval = nconc(retval, pull_var_clause(lfirst(temp)));
@@ -176,7 +176,7 @@ pull_var_clause(Node * clause)
}
else if (IsA(clause, ArrayRef))
{
List *temp;
List *temp;
foreach(temp, ((ArrayRef *) clause)->refupperindexpr)
retval = nconc(retval, pull_var_clause(lfirst(temp)));