mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
Use the new List API function names throughout the backend, and disable the
list compatibility API by default. While doing this, I decided to keep the llast() macro around and introduce llast_int() and llast_oid() variants.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.115 2004/05/26 04:41:21 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.116 2004/05/30 23:40:28 neilc Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -88,7 +88,7 @@ make_one_rel(Query *root)
|
||||
/*
|
||||
* The result should join all the query's base rels.
|
||||
*/
|
||||
Assert(bms_num_members(rel->relids) == length(root->base_rel_list));
|
||||
Assert(bms_num_members(rel->relids) == list_length(root->base_rel_list));
|
||||
|
||||
return rel;
|
||||
}
|
||||
@ -218,7 +218,7 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
|
||||
* XXX for now, can't handle inherited expansion of FOR UPDATE; can we
|
||||
* do better?
|
||||
*/
|
||||
if (intMember(parentRTindex, root->rowMarks))
|
||||
if (list_member_int(root->rowMarks, parentRTindex))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("SELECT FOR UPDATE is not supported for inheritance queries")));
|
||||
@ -242,7 +242,7 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
|
||||
*/
|
||||
foreach(il, inheritlist)
|
||||
{
|
||||
int childRTindex = lfirsti(il);
|
||||
int childRTindex = lfirst_int(il);
|
||||
RangeTblEntry *childrte;
|
||||
Oid childOID;
|
||||
RelOptInfo *childrel;
|
||||
@ -338,7 +338,7 @@ set_subquery_pathlist(Query *root, RelOptInfo *rel,
|
||||
|
||||
/* We need a workspace for keeping track of set-op type coercions */
|
||||
differentTypes = (bool *)
|
||||
palloc0((length(subquery->targetList) + 1) * sizeof(bool));
|
||||
palloc0((list_length(subquery->targetList) + 1) * sizeof(bool));
|
||||
|
||||
/*
|
||||
* If there are any restriction clauses that have been attached to the
|
||||
@ -441,7 +441,7 @@ make_fromexpr_rel(Query *root, FromExpr *from)
|
||||
* dynamic-programming algorithm we must employ to consider all ways
|
||||
* of joining the child nodes.
|
||||
*/
|
||||
levels_needed = length(from->fromlist);
|
||||
levels_needed = list_length(from->fromlist);
|
||||
|
||||
if (levels_needed <= 0)
|
||||
return NULL; /* nothing to do? */
|
||||
@ -546,7 +546,7 @@ make_one_rel_by_joins(Query *root, int levels_needed, List *initial_rels)
|
||||
*/
|
||||
if (joinitems[levels_needed] == NIL)
|
||||
elog(ERROR, "failed to build any %d-way joins", levels_needed);
|
||||
Assert(length(joinitems[levels_needed]) == 1);
|
||||
Assert(list_length(joinitems[levels_needed]) == 1);
|
||||
|
||||
rel = (RelOptInfo *) linitial(joinitems[levels_needed]);
|
||||
|
||||
@ -770,7 +770,7 @@ qual_is_pushdown_safe(Query *subquery, Index rti, Node *qual,
|
||||
}
|
||||
}
|
||||
|
||||
freeList(vars);
|
||||
list_free(vars);
|
||||
bms_free(tested);
|
||||
|
||||
return safe;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/clausesel.c,v 1.66 2004/05/26 04:41:21 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/clausesel.c,v 1.67 2004/05/30 23:40:28 neilc Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -131,7 +131,7 @@ clauselist_selectivity(Query *root,
|
||||
* behave in the simple way we are expecting.) Most of the tests
|
||||
* here can be done more efficiently with rinfo than without.
|
||||
*/
|
||||
if (is_opclause(clause) && length(((OpExpr *) clause)->args) == 2)
|
||||
if (is_opclause(clause) && list_length(((OpExpr *) clause)->args) == 2)
|
||||
{
|
||||
OpExpr *expr = (OpExpr *) clause;
|
||||
bool varonleft = true;
|
||||
@ -480,8 +480,8 @@ clause_selectivity(Query *root,
|
||||
*/
|
||||
s1 = restriction_selectivity(root,
|
||||
BooleanEqualOperator,
|
||||
makeList2(var,
|
||||
makeBoolConst(true,
|
||||
list_make2(var,
|
||||
makeBoolConst(true,
|
||||
false)),
|
||||
varRelid);
|
||||
}
|
||||
|
@ -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.127 2004/05/26 04:41:21 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.128 2004/05/30 23:40:28 neilc Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -412,7 +412,7 @@ cost_tidscan(Path *path, Query *root,
|
||||
Cost startup_cost = 0;
|
||||
Cost run_cost = 0;
|
||||
Cost cpu_per_tuple;
|
||||
int ntuples = length(tideval);
|
||||
int ntuples = list_length(tideval);
|
||||
|
||||
/* Should only be applied to base relations */
|
||||
Assert(baserel->relid > 0);
|
||||
@ -1063,7 +1063,7 @@ cost_hashjoin(HashPath *path, Query *root)
|
||||
outer_path->parent->width);
|
||||
double innerbytes = relation_byte_size(inner_path_rows,
|
||||
inner_path->parent->width);
|
||||
int num_hashclauses = length(hashclauses);
|
||||
int num_hashclauses = list_length(hashclauses);
|
||||
int virtualbuckets;
|
||||
int physicalbuckets;
|
||||
int numbatches;
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.159 2004/05/26 04:41:21 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.160 2004/05/30 23:40:28 neilc Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1042,11 +1042,11 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
|
||||
Expr *nonnullarg = ((NullTest *) predicate)->arg;
|
||||
|
||||
if (is_opclause(clause) &&
|
||||
member(nonnullarg, ((OpExpr *) clause)->args) &&
|
||||
list_member(((OpExpr *) clause)->args, nonnullarg) &&
|
||||
op_strict(((OpExpr *) clause)->opno))
|
||||
return true;
|
||||
if (is_funcclause(clause) &&
|
||||
member(nonnullarg, ((FuncExpr *) clause)->args) &&
|
||||
list_member(((FuncExpr *) clause)->args, nonnullarg) &&
|
||||
func_strict(((FuncExpr *) clause)->funcid))
|
||||
return true;
|
||||
return false; /* we can't succeed below... */
|
||||
@ -1624,9 +1624,9 @@ make_innerjoin_index_path(Query *root,
|
||||
* Note that we are making a pathnode for a single-scan indexscan;
|
||||
* therefore, indexinfo etc should be single-element lists.
|
||||
*/
|
||||
pathnode->indexinfo = makeList1(index);
|
||||
pathnode->indexclauses = makeList1(allclauses);
|
||||
pathnode->indexquals = makeList1(indexquals);
|
||||
pathnode->indexinfo = list_make1(index);
|
||||
pathnode->indexclauses = list_make1(allclauses);
|
||||
pathnode->indexquals = list_make1(indexquals);
|
||||
|
||||
pathnode->isjoininner = true;
|
||||
|
||||
@ -1649,7 +1649,7 @@ make_innerjoin_index_path(Query *root,
|
||||
* Always assume the join type is JOIN_INNER; even if some of the join
|
||||
* clauses come from other contexts, that's not our problem.
|
||||
*/
|
||||
allclauses = set_ptrUnion(rel->baserestrictinfo, allclauses);
|
||||
allclauses = list_union_ptr(rel->baserestrictinfo, allclauses);
|
||||
pathnode->rows = rel->tuples *
|
||||
clauselist_selectivity(root,
|
||||
allclauses,
|
||||
@ -1679,7 +1679,7 @@ flatten_clausegroups_list(List *clausegroups)
|
||||
|
||||
foreach(l, clausegroups)
|
||||
{
|
||||
allclauses = nconc(allclauses, listCopy((List *) lfirst(l)));
|
||||
allclauses = list_concat(allclauses, list_copy((List *) lfirst(l)));
|
||||
}
|
||||
return allclauses;
|
||||
}
|
||||
@ -1711,7 +1711,7 @@ make_expr_from_indexclauses(List *indexclauses)
|
||||
orclauses = lappend(orclauses, make_ands_explicit(andlist));
|
||||
}
|
||||
|
||||
if (length(orclauses) > 1)
|
||||
if (list_length(orclauses) > 1)
|
||||
return make_orclause(orclauses);
|
||||
else
|
||||
return (Expr *) linitial(orclauses);
|
||||
@ -2114,7 +2114,7 @@ expand_indexqual_condition(RestrictInfo *rinfo, Oid opclass)
|
||||
break;
|
||||
|
||||
default:
|
||||
result = makeList1(rinfo);
|
||||
result = list_make1(rinfo);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2209,7 +2209,7 @@ prefix_quals(Node *leftop, Oid opclass,
|
||||
elog(ERROR, "no = operator for opclass %u", opclass);
|
||||
expr = make_opclause(oproid, BOOLOID, false,
|
||||
(Expr *) leftop, (Expr *) prefix_const);
|
||||
result = makeList1(make_restrictinfo(expr, true, true));
|
||||
result = list_make1(make_restrictinfo(expr, true, true));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -2224,7 +2224,7 @@ prefix_quals(Node *leftop, Oid opclass,
|
||||
elog(ERROR, "no >= operator for opclass %u", opclass);
|
||||
expr = make_opclause(oproid, BOOLOID, false,
|
||||
(Expr *) leftop, (Expr *) prefix_const);
|
||||
result = makeList1(make_restrictinfo(expr, true, true));
|
||||
result = list_make1(make_restrictinfo(expr, true, true));
|
||||
|
||||
/*-------
|
||||
* If we can create a string larger than the prefix, we can say
|
||||
@ -2311,7 +2311,7 @@ network_prefix_quals(Node *leftop, Oid expr_op, Oid opclass, Datum rightop)
|
||||
(Expr *) leftop,
|
||||
(Expr *) makeConst(datatype, -1, opr1right,
|
||||
false, false));
|
||||
result = makeList1(make_restrictinfo(expr, true, true));
|
||||
result = list_make1(make_restrictinfo(expr, true, true));
|
||||
|
||||
/* create clause "key <= network_scan_last( rightop )" */
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.87 2004/05/26 04:41:22 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.88 2004/05/30 23:40:28 neilc Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -236,8 +236,8 @@ sort_inner_and_outer(Query *root,
|
||||
/* Make a pathkey list with this guy first. */
|
||||
if (l != list_head(all_pathkeys))
|
||||
cur_pathkeys = lcons(front_pathkey,
|
||||
lremove(front_pathkey,
|
||||
listCopy(all_pathkeys)));
|
||||
list_delete_ptr(list_copy(all_pathkeys),
|
||||
front_pathkey));
|
||||
else
|
||||
cur_pathkeys = all_pathkeys; /* no work at first one... */
|
||||
|
||||
@ -254,7 +254,7 @@ sort_inner_and_outer(Query *root,
|
||||
|
||||
/* Forget it if can't use all the clauses in right/full join */
|
||||
if (useallclauses &&
|
||||
length(cur_mergeclauses) != length(mergeclause_list))
|
||||
list_length(cur_mergeclauses) != list_length(mergeclause_list))
|
||||
continue;
|
||||
|
||||
/*
|
||||
@ -510,7 +510,7 @@ match_unsorted_outer(Query *root,
|
||||
else
|
||||
continue;
|
||||
}
|
||||
if (useallclauses && length(mergeclauses) != length(mergeclause_list))
|
||||
if (useallclauses && list_length(mergeclauses) != list_length(mergeclause_list))
|
||||
continue;
|
||||
|
||||
/* Compute the required ordering of the inner path */
|
||||
@ -547,9 +547,9 @@ match_unsorted_outer(Query *root,
|
||||
* consider both cheap startup cost and cheap total cost. Ignore
|
||||
* inner_cheapest_total, since we already made a path with it.
|
||||
*/
|
||||
num_sortkeys = length(innersortkeys);
|
||||
num_sortkeys = list_length(innersortkeys);
|
||||
if (num_sortkeys > 1 && !useallclauses)
|
||||
trialsortkeys = listCopy(innersortkeys); /* need modifiable copy */
|
||||
trialsortkeys = list_copy(innersortkeys); /* need modifiable copy */
|
||||
else
|
||||
trialsortkeys = innersortkeys; /* won't really truncate */
|
||||
cheapest_startup_inner = NULL;
|
||||
@ -565,7 +565,7 @@ match_unsorted_outer(Query *root,
|
||||
* 'sortkeycnt' innersortkeys. NB: trialsortkeys list is
|
||||
* modified destructively, which is why we made a copy...
|
||||
*/
|
||||
trialsortkeys = ltruncate(sortkeycnt, trialsortkeys);
|
||||
trialsortkeys = list_truncate(trialsortkeys, sortkeycnt);
|
||||
innerpath = get_cheapest_path_for_pathkeys(innerrel->pathlist,
|
||||
trialsortkeys,
|
||||
TOTAL_COST);
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/joinrels.c,v 1.68 2004/05/26 04:41:22 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/joinrels.c,v 1.69 2004/05/30 23:40:28 neilc Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -121,7 +121,7 @@ make_rels_by_joins(Query *root, int level, List **joinrels)
|
||||
{
|
||||
RelOptInfo *jrel = (RelOptInfo *) lfirst(nr);
|
||||
|
||||
if (!ptrMember(jrel, result_rels))
|
||||
if (!list_member_ptr(result_rels, jrel))
|
||||
result_rels = lcons(jrel, result_rels);
|
||||
}
|
||||
}
|
||||
@ -185,7 +185,7 @@ make_rels_by_joins(Query *root, int level, List **joinrels)
|
||||
jrel = make_join_rel(root, old_rel, new_rel,
|
||||
JOIN_INNER);
|
||||
/* Avoid making duplicate entries ... */
|
||||
if (jrel && !ptrMember(jrel, result_rels))
|
||||
if (jrel && !list_member_ptr(result_rels, jrel))
|
||||
result_rels = lcons(jrel, result_rels);
|
||||
break; /* need not consider more
|
||||
* joininfos */
|
||||
@ -234,7 +234,7 @@ make_rels_by_joins(Query *root, int level, List **joinrels)
|
||||
{
|
||||
RelOptInfo *jrel = (RelOptInfo *) lfirst(nr);
|
||||
|
||||
if (!ptrMember(jrel, result_rels))
|
||||
if (!list_member_ptr(result_rels, jrel))
|
||||
result_rels = lcons(jrel, result_rels);
|
||||
}
|
||||
}
|
||||
@ -308,7 +308,7 @@ make_rels_by_clause_joins(Query *root,
|
||||
* Avoid entering same joinrel into our output list more
|
||||
* than once.
|
||||
*/
|
||||
if (jrel && !ptrMember(jrel, result))
|
||||
if (jrel && !list_member_ptr(result, jrel))
|
||||
result = lcons(jrel, result);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/orindxpath.c,v 1.58 2004/05/26 04:41:22 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/orindxpath.c,v 1.59 2004/05/30 23:40:28 neilc Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -149,9 +149,9 @@ create_or_index_quals(Query *root, RelOptInfo *rel)
|
||||
*/
|
||||
newrinfos = make_restrictinfo_from_indexclauses(bestpath->indexclauses,
|
||||
true, true);
|
||||
Assert(length(newrinfos) == 1);
|
||||
Assert(list_length(newrinfos) == 1);
|
||||
or_rinfo = (RestrictInfo *) linitial(newrinfos);
|
||||
rel->baserestrictinfo = nconc(rel->baserestrictinfo, newrinfos);
|
||||
rel->baserestrictinfo = list_concat(rel->baserestrictinfo, newrinfos);
|
||||
|
||||
/*
|
||||
* Adjust the original OR clause's cached selectivity to compensate
|
||||
|
@ -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.57 2004/05/26 04:41:22 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/pathkeys.c,v 1.58 2004/05/30 23:40:28 neilc Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -126,8 +126,8 @@ add_equijoined_keys(Query *root, RestrictInfo *restrictinfo)
|
||||
while (cursetlink)
|
||||
{
|
||||
List *curset = (List *) lfirst(cursetlink);
|
||||
bool item1here = member(item1, curset);
|
||||
bool item2here = member(item2, curset);
|
||||
bool item1here = list_member(curset, item1);
|
||||
bool item2here = list_member(curset, item2);
|
||||
|
||||
/* must advance cursetlink before lremove possibly pfree's it */
|
||||
cursetlink = lnext(cursetlink);
|
||||
@ -147,22 +147,22 @@ add_equijoined_keys(Query *root, RestrictInfo *restrictinfo)
|
||||
|
||||
/* Build the new set only when we know we must */
|
||||
if (newset == NIL)
|
||||
newset = makeList2(item1, item2);
|
||||
newset = list_make2(item1, item2);
|
||||
|
||||
/* Found a set to merge into our new set */
|
||||
newset = set_union(newset, curset);
|
||||
newset = list_union(newset, curset);
|
||||
|
||||
/*
|
||||
* Remove old set from equi_key_list.
|
||||
*/
|
||||
root->equi_key_list = lremove(curset, root->equi_key_list);
|
||||
freeList(curset); /* might as well recycle old cons cells */
|
||||
root->equi_key_list = list_delete_ptr(root->equi_key_list, curset);
|
||||
list_free(curset); /* might as well recycle old cons cells */
|
||||
}
|
||||
}
|
||||
|
||||
/* Build the new set only when we know we must */
|
||||
if (newset == NIL)
|
||||
newset = makeList2(item1, item2);
|
||||
newset = list_make2(item1, item2);
|
||||
|
||||
root->equi_key_list = lcons(newset, root->equi_key_list);
|
||||
}
|
||||
@ -204,7 +204,7 @@ generate_implied_equalities(Query *root)
|
||||
foreach(cursetlink, root->equi_key_list)
|
||||
{
|
||||
List *curset = (List *) lfirst(cursetlink);
|
||||
int nitems = length(curset);
|
||||
int nitems = list_length(curset);
|
||||
Relids *relids;
|
||||
bool have_consts;
|
||||
ListCell *ptr1;
|
||||
@ -341,10 +341,10 @@ make_canonical_pathkey(Query *root, PathKeyItem *item)
|
||||
{
|
||||
List *curset = (List *) lfirst(cursetlink);
|
||||
|
||||
if (member(item, curset))
|
||||
if (list_member(curset, item))
|
||||
return curset;
|
||||
}
|
||||
newset = makeList1(item);
|
||||
newset = list_make1(item);
|
||||
root->equi_key_list = lcons(newset, root->equi_key_list);
|
||||
return newset;
|
||||
}
|
||||
@ -383,7 +383,7 @@ canonicalize_pathkeys(Query *root, List *pathkeys)
|
||||
* canonicalized the keys, so that equivalent-key knowledge is
|
||||
* used when deciding if an item is redundant.
|
||||
*/
|
||||
if (!ptrMember(cpathkey, new_pathkeys))
|
||||
if (!list_member_ptr(new_pathkeys, cpathkey))
|
||||
new_pathkeys = lappend(new_pathkeys, cpathkey);
|
||||
}
|
||||
return new_pathkeys;
|
||||
@ -408,8 +408,8 @@ count_canonical_peers(Query *root, PathKeyItem *item)
|
||||
{
|
||||
List *curset = (List *) lfirst(cursetlink);
|
||||
|
||||
if (member(item, curset))
|
||||
return length(curset) - 1;
|
||||
if (list_member(curset, item))
|
||||
return list_length(curset) - 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -443,8 +443,8 @@ compare_pathkeys(List *keys1, List *keys2)
|
||||
* input, but query root not accessible here...
|
||||
*/
|
||||
#ifdef NOT_USED
|
||||
Assert(ptrMember(subkey1, root->equi_key_list));
|
||||
Assert(ptrMember(subkey2, root->equi_key_list));
|
||||
Assert(list_member_ptr(root->equi_key_list, subkey1));
|
||||
Assert(list_member_ptr(root->equi_key_list, subkey2));
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -499,8 +499,8 @@ compare_noncanonical_pathkeys(List *keys1, List *keys2)
|
||||
List *subkey1 = (List *) lfirst(key1);
|
||||
List *subkey2 = (List *) lfirst(key2);
|
||||
|
||||
Assert(length(subkey1) == 1);
|
||||
Assert(length(subkey2) == 1);
|
||||
Assert(list_length(subkey1) == 1);
|
||||
Assert(list_length(subkey2) == 1);
|
||||
if (!equal(subkey1, subkey2))
|
||||
return PATHKEYS_DIFFERENT; /* no need to keep looking */
|
||||
}
|
||||
@ -693,7 +693,7 @@ build_index_pathkeys(Query *root,
|
||||
* Eliminate redundant ordering info; could happen if query is
|
||||
* such that index keys are equijoined...
|
||||
*/
|
||||
if (!ptrMember(cpathkey, retval))
|
||||
if (!list_member_ptr(retval, cpathkey))
|
||||
retval = lappend(retval, cpathkey);
|
||||
|
||||
indexkeys++;
|
||||
@ -752,7 +752,7 @@ build_subquery_pathkeys(Query *root, RelOptInfo *rel, Query *subquery)
|
||||
{
|
||||
List *retval = NIL;
|
||||
int retvallen = 0;
|
||||
int outer_query_keys = length(root->query_pathkeys);
|
||||
int outer_query_keys = list_length(root->query_pathkeys);
|
||||
List *sub_tlist = rel->subplan->targetlist;
|
||||
ListCell *i;
|
||||
|
||||
@ -810,8 +810,7 @@ build_subquery_pathkeys(Query *root, RelOptInfo *rel, Query *subquery)
|
||||
score = count_canonical_peers(root, outer_item);
|
||||
/* +1 if it matches the proper query_pathkeys item */
|
||||
if (retvallen < outer_query_keys &&
|
||||
member(outer_item,
|
||||
nth(retvallen, root->query_pathkeys)))
|
||||
list_member(list_nth(root->query_pathkeys, retvallen), outer_item))
|
||||
score++;
|
||||
if (score > best_score)
|
||||
{
|
||||
@ -836,7 +835,7 @@ build_subquery_pathkeys(Query *root, RelOptInfo *rel, Query *subquery)
|
||||
* Eliminate redundant ordering info; could happen if outer query
|
||||
* equijoins subquery keys...
|
||||
*/
|
||||
if (!ptrMember(cpathkey, retval))
|
||||
if (!list_member_ptr(retval, cpathkey))
|
||||
{
|
||||
retval = lappend(retval, cpathkey);
|
||||
retvallen++;
|
||||
@ -920,7 +919,7 @@ make_pathkeys_for_sortclauses(List *sortclauses,
|
||||
* canonicalize_pathkeys() might replace it with a longer sublist
|
||||
* later.
|
||||
*/
|
||||
pathkeys = lappend(pathkeys, makeList1(pathkey));
|
||||
pathkeys = lappend(pathkeys, list_make1(pathkey));
|
||||
}
|
||||
return pathkeys;
|
||||
}
|
||||
@ -1041,7 +1040,7 @@ find_mergeclauses_for_pathkeys(Query *root,
|
||||
*/
|
||||
if ((pathkey == restrictinfo->left_pathkey ||
|
||||
pathkey == restrictinfo->right_pathkey) &&
|
||||
!ptrMember(restrictinfo, mergeclauses))
|
||||
!list_member_ptr(mergeclauses, restrictinfo))
|
||||
{
|
||||
matched_restrictinfos = lappend(matched_restrictinfos,
|
||||
restrictinfo);
|
||||
@ -1060,7 +1059,7 @@ find_mergeclauses_for_pathkeys(Query *root,
|
||||
* If we did find usable mergeclause(s) for this sort-key
|
||||
* position, add them to result list.
|
||||
*/
|
||||
mergeclauses = nconc(mergeclauses, matched_restrictinfos);
|
||||
mergeclauses = list_concat(mergeclauses, matched_restrictinfos);
|
||||
}
|
||||
|
||||
return mergeclauses;
|
||||
@ -1124,7 +1123,7 @@ make_pathkeys_for_mergeclauses(Query *root,
|
||||
* pathkey, a simple ptrMember test is sufficient to detect
|
||||
* redundant keys.
|
||||
*/
|
||||
if (!ptrMember(pathkey, pathkeys))
|
||||
if (!list_member_ptr(pathkeys, pathkey))
|
||||
pathkeys = lappend(pathkeys, pathkey);
|
||||
}
|
||||
|
||||
@ -1214,7 +1213,7 @@ pathkeys_useful_for_merging(Query *root, RelOptInfo *rel, List *pathkeys)
|
||||
*
|
||||
* Unlike merge pathkeys, this is an all-or-nothing affair: it does us
|
||||
* no good to order by just the first key(s) of the requested ordering.
|
||||
* So the result is always either 0 or length(root->query_pathkeys).
|
||||
* So the result is always either 0 or list_length(root->query_pathkeys).
|
||||
*/
|
||||
int
|
||||
pathkeys_useful_for_ordering(Query *root, List *pathkeys)
|
||||
@ -1228,7 +1227,7 @@ pathkeys_useful_for_ordering(Query *root, List *pathkeys)
|
||||
if (pathkeys_contained_in(root->query_pathkeys, pathkeys))
|
||||
{
|
||||
/* It's useful ... or at least the first N keys are */
|
||||
return length(root->query_pathkeys);
|
||||
return list_length(root->query_pathkeys);
|
||||
}
|
||||
|
||||
return 0; /* path ordering not useful */
|
||||
@ -1255,8 +1254,8 @@ truncate_useless_pathkeys(Query *root,
|
||||
* Note: not safe to modify input list destructively, but we can avoid
|
||||
* copying the list if we're not actually going to change it
|
||||
*/
|
||||
if (nuseful == length(pathkeys))
|
||||
if (nuseful == list_length(pathkeys))
|
||||
return pathkeys;
|
||||
else
|
||||
return ltruncate(nuseful, listCopy(pathkeys));
|
||||
return list_truncate(list_copy(pathkeys), nuseful);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/tidpath.c,v 1.19 2004/05/26 04:41:22 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/tidpath.c,v 1.20 2004/05/30 23:40:28 neilc Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -79,7 +79,7 @@ TidequalClause(int varno, OpExpr *node)
|
||||
|
||||
if (node->opno != TIDEqualOperator)
|
||||
return rnode;
|
||||
if (length(node->args) != 2)
|
||||
if (list_length(node->args) != 2)
|
||||
return rnode;
|
||||
arg1 = linitial(node->args);
|
||||
arg2 = lsecond(node->args);
|
||||
@ -184,11 +184,11 @@ TidqualFromExpr(int varno, Expr *expr)
|
||||
node = (Node *) lfirst(l);
|
||||
frtn = TidqualFromExpr(varno, (Expr *) node);
|
||||
if (frtn)
|
||||
rlst = nconc(rlst, frtn);
|
||||
rlst = list_concat(rlst, frtn);
|
||||
else
|
||||
{
|
||||
if (rlst)
|
||||
freeList(rlst);
|
||||
list_free(rlst);
|
||||
rlst = NIL;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user