Desultory de-FastList-ification. RelOptInfo.reltargetlist is back to

being a plain List.
This commit is contained in:
Tom Lane 2004-06-01 03:03:05 +00:00
parent 6c33054a0c
commit 80c6847cc5
8 changed files with 38 additions and 45 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.116 2004/05/30 23:40:28 neilc Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.117 2004/06/01 03:02:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -246,7 +246,6 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
RangeTblEntry *childrte;
Oid childOID;
RelOptInfo *childrel;
List *reltlist;
ListCell *parentvars;
ListCell *childvars;
@ -268,14 +267,12 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
* the individual tables. Also, we just zap attr_needed rather
* than trying to adjust it; it won't be looked at in the child.
*/
reltlist = FastListValue(&rel->reltargetlist);
reltlist = (List *)
adjust_inherited_attrs((Node *) reltlist,
childrel->reltargetlist = (List *)
adjust_inherited_attrs((Node *) rel->reltargetlist,
parentRTindex,
parentOID,
childRTindex,
childOID);
FastListFromList(&childrel->reltargetlist, reltlist);
childrel->attr_needed = NULL;
childrel->baserestrictinfo = (List *)
adjust_inherited_attrs((Node *) rel->baserestrictinfo,
@ -300,8 +297,8 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
if (childrel->width > rel->width)
rel->width = childrel->width;
childvars = list_head(FastListValue(&childrel->reltargetlist));
foreach(parentvars, FastListValue(&rel->reltargetlist))
forboth(parentvars, rel->reltargetlist,
childvars, childrel->reltargetlist)
{
Var *parentvar = (Var *) lfirst(parentvars);
Var *childvar = (Var *) lfirst(childvars);
@ -310,7 +307,6 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
if (childrel->attr_widths[childndx] > rel->attr_widths[parentndx])
rel->attr_widths[parentndx] = childrel->attr_widths[childndx];
childvars = lnext(childvars);
}
}

View File

@ -49,7 +49,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.128 2004/05/30 23:40:28 neilc Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.129 2004/06/01 03:02:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1701,7 +1701,7 @@ set_rel_width(Query *root, RelOptInfo *rel)
int32 tuple_width = 0;
ListCell *tllist;
foreach(tllist, FastListValue(&rel->reltargetlist))
foreach(tllist, rel->reltargetlist)
{
Var *var = (Var *) lfirst(tllist);
int ndx = var->varattno - rel->min_attr;

View File

@ -11,7 +11,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/path/pathkeys.c,v 1.58 2004/05/30 23:40:28 neilc Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/path/pathkeys.c,v 1.59 2004/06/01 03:02:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -721,12 +721,11 @@ find_indexkey_var(Query *root, RelOptInfo *rel, AttrNumber varattno)
vartypeid;
int32 type_mod;
foreach(temp, FastListValue(&rel->reltargetlist))
foreach(temp, rel->reltargetlist)
{
Var *var = (Var *) lfirst(temp);
if (IsA(var, Var) &&
var->varattno == varattno)
if (var->varattno == varattno)
return var;
}

View File

@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.171 2004/05/30 23:40:28 neilc Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.172 2004/06/01 03:02:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -261,20 +261,19 @@ create_scan_plan(Query *root, Path *best_path)
static List *
build_relation_tlist(RelOptInfo *rel)
{
FastList tlist;
List *tlist = NIL;
int resdomno = 1;
ListCell *v;
FastListInit(&tlist);
foreach(v, FastListValue(&rel->reltargetlist))
foreach(v, rel->reltargetlist)
{
/* Do we really need to copy here? Not sure */
Var *var = (Var *) copyObject(lfirst(v));
FastAppend(&tlist, create_tl_element(var, resdomno));
tlist = lappend(tlist, create_tl_element(var, resdomno));
resdomno++;
}
return FastListValue(&tlist);
return tlist;
}
/*
@ -701,7 +700,7 @@ create_indexscan_plan(Query *root,
List *indxstrategy;
List *indxsubtype;
List *indxlossy;
FastList indexids;
List *indexids;
ListCell *l;
IndexScan *scan_plan;
@ -737,12 +736,12 @@ create_indexscan_plan(Query *root,
scan_clauses = order_qual_clauses(root, scan_clauses);
/* Build list of index OIDs */
FastListInit(&indexids);
indexids = NIL;
foreach(l, best_path->indexinfo)
{
IndexOptInfo *index = (IndexOptInfo *) lfirst(l);
FastAppendo(&indexids, index->indexoid);
indexids = lappend_oid(indexids, index->indexoid);
}
/*
@ -801,7 +800,7 @@ create_indexscan_plan(Query *root,
scan_plan = make_indexscan(tlist,
qpqual,
baserelid,
FastListValue(&indexids),
indexids,
fixed_indxquals,
stripped_indxquals,
indxstrategy,
@ -1427,28 +1426,27 @@ get_switched_clauses(List *clauses, Relids outerrelids)
static List *
order_qual_clauses(Query *root, List *clauses)
{
FastList nosubplans;
FastList withsubplans;
List *nosubplans;
List *withsubplans;
ListCell *l;
/* No need to work hard if the query is subselect-free */
if (!root->hasSubLinks)
return clauses;
FastListInit(&nosubplans);
FastListInit(&withsubplans);
nosubplans = NIL;
withsubplans = NIL;
foreach(l, clauses)
{
Node *clause = (Node *) lfirst(l);
if (contain_subplans(clause))
FastAppend(&withsubplans, clause);
withsubplans = lappend(withsubplans, clause);
else
FastAppend(&nosubplans, clause);
nosubplans = lappend(nosubplans, clause);
}
FastConcFast(&nosubplans, &withsubplans);
return FastListValue(&nosubplans);
return list_concat(nosubplans, withsubplans);
}
/*

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.100 2004/05/30 23:40:29 neilc Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.101 2004/06/01 03:02:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -151,7 +151,7 @@ add_vars_to_targetlist(Query *root, List *vars, Relids where_needed)
{
/* Variable not yet requested, so add to reltargetlist */
/* XXX is copyObject necessary here? */
FastAppend(&rel->reltargetlist, copyObject(var));
rel->reltargetlist = lappend(rel->reltargetlist, copyObject(var));
}
rel->attr_needed[attrno] = bms_add_members(rel->attr_needed[attrno],
where_needed);

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.106 2004/05/30 23:40:31 neilc Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.107 2004/06/01 03:03:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -691,7 +691,7 @@ create_unique_path(Query *root, RelOptInfo *rel, Path *subpath)
else
{
pathnode->rows = rel->rows;
numCols = list_length(FastListValue(&rel->reltargetlist));
numCols = list_length(rel->reltargetlist);
}
/*

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.58 2004/05/30 23:40:31 neilc Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.59 2004/06/01 03:03:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -130,7 +130,7 @@ make_base_rel(Query *root, int relid)
rel->relids = bms_make_singleton(relid);
rel->rows = 0;
rel->width = 0;
FastListInit(&rel->reltargetlist);
rel->reltargetlist = NIL;
rel->pathlist = NIL;
rel->cheapest_startup_path = NULL;
rel->cheapest_total_path = NULL;
@ -285,7 +285,7 @@ build_join_rel(Query *root,
joinrel->relids = bms_copy(joinrelids);
joinrel->rows = 0;
joinrel->width = 0;
FastListInit(&joinrel->reltargetlist);
joinrel->reltargetlist = NIL;
joinrel->pathlist = NIL;
joinrel->cheapest_startup_path = NULL;
joinrel->cheapest_total_path = NULL;
@ -365,7 +365,7 @@ build_joinrel_tlist(Query *root, RelOptInfo *joinrel)
Relids relids = joinrel->relids;
ListCell *rels;
FastListInit(&joinrel->reltargetlist);
joinrel->reltargetlist = NIL;
joinrel->width = 0;
foreach(rels, root->base_rel_list)
@ -376,14 +376,14 @@ build_joinrel_tlist(Query *root, RelOptInfo *joinrel)
if (!bms_is_member(baserel->relid, relids))
continue;
foreach(vars, FastListValue(&baserel->reltargetlist))
foreach(vars, baserel->reltargetlist)
{
Var *var = (Var *) lfirst(vars);
int ndx = var->varattno - baserel->min_attr;
if (bms_nonempty_difference(baserel->attr_needed[ndx], relids))
{
FastAppend(&joinrel->reltargetlist, var);
joinrel->reltargetlist = lappend(joinrel->reltargetlist, var);
Assert(baserel->attr_widths[ndx] > 0);
joinrel->width += baserel->attr_widths[ndx];
}

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.94 2004/04/25 18:23:57 neilc Exp $
* $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.95 2004/06/01 03:03:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -186,7 +186,7 @@ typedef struct RelOptInfo
int width; /* estimated avg width of result tuples */
/* materialization information */
FastList reltargetlist;
List *reltargetlist; /* needed Vars */
List *pathlist; /* Path structures */
struct Path *cheapest_startup_path;
struct Path *cheapest_total_path;