OSDN Git Service

Use the new List API function names throughout the backend, and disable the
authorNeil Conway <neilc@samurai.com>
Sun, 30 May 2004 23:40:41 +0000 (23:40 +0000)
committerNeil Conway <neilc@samurai.com>
Sun, 30 May 2004 23:40:41 +0000 (23:40 +0000)
list compatibility API by default. While doing this, I decided to keep
the llast() macro around and introduce llast_int() and llast_oid() variants.

83 files changed:
contrib/tsearch2/tsvector.c
src/backend/access/common/tupdesc.c
src/backend/access/nbtree/nbtxlog.c
src/backend/executor/execMain.c
src/backend/executor/execQual.c
src/backend/executor/execTuples.c
src/backend/executor/execUtils.c
src/backend/executor/nodeAgg.c
src/backend/executor/nodeAppend.c
src/backend/executor/nodeHash.c
src/backend/executor/nodeHashjoin.c
src/backend/executor/nodeIndexscan.c
src/backend/executor/nodeMergejoin.c
src/backend/executor/nodeSubplan.c
src/backend/executor/nodeTidscan.c
src/backend/executor/spi.c
src/backend/libpq/hba.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/nodes/list.c
src/backend/nodes/makefuncs.c
src/backend/nodes/outfuncs.c
src/backend/nodes/print.c
src/backend/nodes/read.c
src/backend/nodes/readfuncs.c
src/backend/optimizer/geqo/geqo_eval.c
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/clausesel.c
src/backend/optimizer/path/costsize.c
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/joinpath.c
src/backend/optimizer/path/joinrels.c
src/backend/optimizer/path/orindxpath.c
src/backend/optimizer/path/pathkeys.c
src/backend/optimizer/path/tidpath.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/subselect.c
src/backend/optimizer/prep/prepjointree.c
src/backend/optimizer/prep/prepqual.c
src/backend/optimizer/prep/preptlist.c
src/backend/optimizer/prep/prepunion.c
src/backend/optimizer/util/clauses.c
src/backend/optimizer/util/joininfo.c
src/backend/optimizer/util/pathnode.c
src/backend/optimizer/util/plancat.c
src/backend/optimizer/util/relnode.c
src/backend/optimizer/util/restrictinfo.c
src/backend/optimizer/util/tlist.c
src/backend/optimizer/util/var.c
src/backend/parser/analyze.c
src/backend/parser/gram.y
src/backend/parser/parse_agg.c
src/backend/parser/parse_clause.c
src/backend/parser/parse_coerce.c
src/backend/parser/parse_expr.c
src/backend/parser/parse_func.c
src/backend/parser/parse_oper.c
src/backend/parser/parse_relation.c
src/backend/parser/parse_target.c
src/backend/parser/parse_type.c
src/backend/rewrite/rewriteDefine.c
src/backend/rewrite/rewriteHandler.c
src/backend/rewrite/rewriteManip.c
src/backend/utils/adt/name.c
src/backend/utils/adt/not_in.c
src/backend/utils/adt/regproc.c
src/backend/utils/adt/ri_triggers.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/selfuncs.c
src/backend/utils/adt/tid.c
src/backend/utils/adt/varlena.c
src/backend/utils/cache/relcache.c
src/backend/utils/fmgr/fmgr.c
src/backend/utils/init/miscinit.c
src/backend/utils/misc/guc.c
src/backend/utils/mmgr/portalmem.c
src/include/nodes/pg_list.h
src/include/nodes/primnodes.h
src/interfaces/ecpg/preproc/preproc.y
src/pl/plpgsql/src/pl_exec.c
src/pl/tcl/pltcl.c

index 827627b..4946634 100644 (file)
@@ -779,10 +779,10 @@ findFunc(char *fname)
        FuncCandidateList clist,
                                ptr;
        Oid                     funcid = InvalidOid;
-       List       *names = makeList1(makeString(fname));
+       List       *names = list_make1(makeString(fname));
 
        ptr = clist = FuncnameGetCandidates(names, 1);
-       freeList(names);
+       list_free(names);
 
        if (!ptr)
                return funcid;
index 4a3c272..a731d80 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/access/common/tupdesc.c,v 1.103 2004/05/26 04:41:03 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/access/common/tupdesc.c,v 1.104 2004/05/30 23:40:25 neilc Exp $
  *
  * NOTES
  *       some of the executor utility code such as "ExecTypeFromTL" should be
@@ -484,7 +484,7 @@ BuildDescForRelation(List *schema)
        /*
         * allocate a new tuple descriptor
         */
-       natts = length(schema);
+       natts = list_length(schema);
        desc = CreateTemplateTupleDesc(natts, false);
        constr->has_not_null = false;
 
@@ -503,7 +503,7 @@ BuildDescForRelation(List *schema)
 
                attname = entry->colname;
                atttypmod = entry->typename->typmod;
-               attdim = length(entry->typename->arrayBounds);
+               attdim = list_length(entry->typename->arrayBounds);
 
                if (entry->typename->setof)
                        ereport(ERROR,
@@ -624,7 +624,7 @@ TypeGetTupleDesc(Oid typeoid, List *colaliases)
                        int                     varattno;
 
                        /* does the list length match the number of attributes? */
-                       if (length(colaliases) != natts)
+                       if (list_length(colaliases) != natts)
                                ereport(ERROR,
                                                (errcode(ERRCODE_DATATYPE_MISMATCH),
                                                 errmsg("number of aliases does not match number of columns")));
@@ -632,7 +632,7 @@ TypeGetTupleDesc(Oid typeoid, List *colaliases)
                        /* OK, use the aliases instead */
                        for (varattno = 0; varattno < natts; varattno++)
                        {
-                               char       *label = strVal(nth(varattno, colaliases));
+                               char       *label = strVal(list_nth(colaliases, varattno));
 
                                if (label != NULL)
                                        namestrcpy(&(tupdesc->attrs[varattno]->attname), label);
@@ -655,7 +655,7 @@ TypeGetTupleDesc(Oid typeoid, List *colaliases)
                                         errmsg("no column alias was provided")));
 
                /* the alias list length must be 1 */
-               if (length(colaliases) != 1)
+               if (list_length(colaliases) != 1)
                        ereport(ERROR,
                                        (errcode(ERRCODE_DATATYPE_MISMATCH),
                                         errmsg("number of aliases does not match number of columns")));
index 693279f..ed47dba 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.11 2004/05/26 04:41:05 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.12 2004/05/30 23:40:25 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -81,7 +81,7 @@ forget_matching_split(Relation reln, RelFileNode node,
                {
                        if (is_root != split->is_root)
                                elog(LOG, "forget_matching_split: fishy is_root data");
-                       incomplete_splits = lremove(split, incomplete_splits);
+                       incomplete_splits = list_delete_ptr(incomplete_splits, split);
                        break;                          /* need not look further */
                }
        }
index 5ee954a..4099ef0 100644 (file)
@@ -26,7 +26,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.232 2004/05/26 04:41:14 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.233 2004/05/30 23:40:26 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -524,7 +524,7 @@ InitPlan(QueryDesc *queryDesc, bool explainOnly)
                        ResultRelInfo   *resultRelInfo;
                        ListCell                *l;
 
-                       numResultRelations = length(resultRelations);
+                       numResultRelations = list_length(resultRelations);
                        resultRelInfos = (ResultRelInfo *)
                                palloc(numResultRelations * sizeof(ResultRelInfo));
                        resultRelInfo = resultRelInfos;
@@ -590,7 +590,7 @@ InitPlan(QueryDesc *queryDesc, bool explainOnly)
 
                foreach(l, parseTree->rowMarks)
                {
-                       Index           rti = lfirsti(l);
+                       Index           rti = lfirst_int(l);
                        Oid                     relid = getrelid(rti, rangeTable);
                        Relation        relation;
                        execRowMark *erm;
@@ -614,7 +614,7 @@ InitPlan(QueryDesc *queryDesc, bool explainOnly)
                int                     nSlots = ExecCountSlotsNode(plan);
 
                if (parseTree->resultRelations != NIL)
-                       nSlots += length(parseTree->resultRelations);
+                       nSlots += list_length(parseTree->resultRelations);
                else
                        nSlots += 1;
                estate->es_tupleTable = ExecCreateTupleTable(nSlots);
@@ -2067,7 +2067,7 @@ EvalPlanQualStart(evalPlanQual *epq, EState *estate, evalPlanQual *priorepq)
        int                     rtsize;
        MemoryContext oldcontext;
 
-       rtsize = length(estate->es_range_table);
+       rtsize = list_length(estate->es_range_table);
 
        epq->estate = epqstate = CreateExecutorState();
 
index 9308848..d3ec919 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.160 2004/05/26 04:41:15 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.161 2004/05/30 23:40:26 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -760,7 +760,7 @@ init_fcache(Oid foid, FuncExprState *fcache, MemoryContext fcacheCxt)
                aclcheck_error(aclresult, ACL_KIND_PROC, get_func_name(foid));
 
        /* Safety check (should never fail, as parser should check sooner) */
-       if (length(fcache->args) > FUNC_MAX_ARGS)
+       if (list_length(fcache->args) > FUNC_MAX_ARGS)
                elog(ERROR, "too many arguments");
 
        /* Set up the primary fmgr lookup information */
@@ -1958,7 +1958,7 @@ ExecEvalArray(ArrayExprState *astate, ExprContext *econtext,
                int                     i = 0;
 
                ndims = 1;
-               nelems = length(astate->elements);
+               nelems = list_length(astate->elements);
 
                /* Shouldn't happen here, but if length is 0, return NULL */
                if (nelems == 0)
@@ -1999,7 +1999,7 @@ ExecEvalArray(ArrayExprState *astate, ExprContext *econtext,
                char       *dat = NULL;
                Size            ndatabytes = 0;
                int                     nbytes;
-               int                     outer_nelems = length(astate->elements);
+               int                     outer_nelems = list_length(astate->elements);
                int                     elem_ndims = 0;
                int                *elem_dims = NULL;
                int                *elem_lbs = NULL;
@@ -2128,7 +2128,7 @@ ExecEvalRow(RowExprState *rstate,
                *isDone = ExprSingleResult;
 
        /* Allocate workspace */
-       nargs = length(rstate->args);
+       nargs = list_length(rstate->args);
        if (nargs == 0)                         /* avoid palloc(0) if no fields */
                nargs = 1;
        values = (Datum *) palloc(nargs * sizeof(Datum));
@@ -3170,7 +3170,7 @@ int
 ExecTargetListLength(List *targetlist)
 {
        /* This used to be more complex, but fjoins are dead */
-       return length(targetlist);
+       return list_length(targetlist);
 }
 
 /*
index a28735c..8dd8cfc 100644 (file)
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.78 2004/05/26 04:41:15 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.79 2004/05/30 23:40:26 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -610,7 +610,7 @@ ExecTypeFromExprList(List *exprList)
        int                      cur_resno = 1;
        char            fldname[NAMEDATALEN];
 
-       typeInfo = CreateTemplateTupleDesc(length(exprList), false);
+       typeInfo = CreateTemplateTupleDesc(list_length(exprList), false);
 
        foreach(l, exprList)
        {
index 811ec51..2b4a2c2 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.111 2004/05/26 04:41:15 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.112 2004/05/30 23:40:26 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -249,7 +249,7 @@ FreeExecutorState(EState *estate)
        while (estate->es_exprcontexts)
        {
                /* XXX: seems there ought to be a faster way to implement this
-                * than repeated lremove(), no?
+                * than repeated list_delete(), no?
                 */
                FreeExprContext((ExprContext *) linitial(estate->es_exprcontexts));
                /* FreeExprContext removed the list link for us */
@@ -355,7 +355,7 @@ FreeExprContext(ExprContext *econtext)
        MemoryContextDelete(econtext->ecxt_per_tuple_memory);
        /* Unlink self from owning EState */
        estate = econtext->ecxt_estate;
-       estate->es_exprcontexts = lremove(econtext, estate->es_exprcontexts);
+       estate->es_exprcontexts = list_delete_ptr(estate->es_exprcontexts, econtext);
        /* And delete the ExprContext node */
        pfree(econtext);
 }
@@ -656,7 +656,7 @@ ExecOpenIndices(ResultRelInfo *resultRelInfo)
         * Get cached list of index OIDs
         */
        indexoidlist = RelationGetIndexList(resultRelation);
-       len = length(indexoidlist);
+       len = list_length(indexoidlist);
        if (len == 0)
                return;
 
@@ -676,7 +676,7 @@ ExecOpenIndices(ResultRelInfo *resultRelInfo)
        i = 0;
        foreach(l, indexoidlist)
        {
-               Oid                     indexOid = lfirsto(l);
+               Oid                     indexOid = lfirst_oid(l);
                Relation        indexDesc;
                IndexInfo  *ii;
 
@@ -713,7 +713,7 @@ ExecOpenIndices(ResultRelInfo *resultRelInfo)
                i++;
        }
 
-       freeList(indexoidlist);
+       list_free(indexoidlist);
 }
 
 /* ----------------------------------------------------------------
index 9884cfe..265828f 100644 (file)
@@ -45,7 +45,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.120 2004/05/26 04:41:15 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.121 2004/05/30 23:40:26 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1120,7 +1120,7 @@ ExecInitAgg(Agg *node, EState *estate)
         * get the count of aggregates in targetlist and quals
         */
        numaggs = aggstate->numaggs;
-       Assert(numaggs == length(aggstate->aggs));
+       Assert(numaggs == list_length(aggstate->aggs));
        if (numaggs <= 0)
        {
                /*
index f23554e..94f7181 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/executor/nodeAppend.c,v 1.57 2004/05/26 04:41:15 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/executor/nodeAppend.c,v 1.58 2004/05/30 23:40:26 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -155,7 +155,7 @@ ExecInitAppend(Append *node, EState *estate)
        /*
         * Set up empty vector of subplan states
         */
-       nplans = length(node->appendplans);
+       nplans = list_length(node->appendplans);
 
        appendplanstates = (PlanState **) palloc0(nplans * sizeof(PlanState *));
 
@@ -215,7 +215,7 @@ ExecInitAppend(Append *node, EState *estate)
                appendstate->as_whichplan = i;
                exec_append_initialize_next(appendstate);
 
-               initNode = (Plan *) nth(i, node->appendplans);
+               initNode = (Plan *) list_nth(node->appendplans, i);
                appendplanstates[i] = ExecInitNode(initNode, estate);
        }
 
index bf9ed89..c7d2196 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.84 2004/05/26 04:41:15 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.85 2004/05/30 23:40:26 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -240,17 +240,17 @@ ExecHashTableCreate(Hash *node, List *hashOperators)
        /*
         * Get info about the hash functions to be used for each hash key.
         */
-       nkeys = length(hashOperators);
+       nkeys = list_length(hashOperators);
        hashtable->hashfunctions = (FmgrInfo *) palloc(nkeys * sizeof(FmgrInfo));
        i = 0;
        foreach(ho, hashOperators)
        {
                Oid                     hashfn;
 
-               hashfn = get_op_hash_function(lfirsto(ho));
+               hashfn = get_op_hash_function(lfirst_oid(ho));
                if (!OidIsValid(hashfn))
                        elog(ERROR, "could not find hash function for hash operator %u",
-                                lfirsto(ho));
+                                lfirst_oid(ho));
                fmgr_info(hashfn, &hashtable->hashfunctions[i]);
                i++;
        }
index da2f6cd..c9e9389 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.61 2004/05/26 04:41:15 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.62 2004/05/30 23:40:26 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -429,7 +429,7 @@ ExecInitHashJoin(HashJoin *node, EState *estate)
                Assert(IsA(hclause, OpExpr));
                lclauses = lappend(lclauses, linitial(fstate->args));
                rclauses = lappend(rclauses, lsecond(fstate->args));
-               hoperators = lappendo(hoperators, hclause->opno);
+               hoperators = lappend_oid(hoperators, hclause->opno);
        }
        hjstate->hj_OuterHashKeys = lclauses;
        hjstate->hj_InnerHashKeys = rclauses;
index c306e45..07062c8 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.94 2004/05/26 04:41:16 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.95 2004/05/30 23:40:26 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -720,7 +720,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
         * get the index node information
         */
        indxid_item = list_head(node->indxid);
-       numIndices = length(node->indxid);
+       numIndices = list_length(node->indxid);
        indexPtr = -1;
 
        CXT1_printf("ExecInitIndexScan: context is %d\n", CurrentMemoryContext);
@@ -772,7 +772,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
                indxsubtype = lnext(indxsubtype);
                lossyflags = (List *) lfirst(indxlossy);
                indxlossy = lnext(indxlossy);
-               n_keys = length(quals);
+               n_keys = list_length(quals);
                scan_keys = (n_keys <= 0) ? NULL :
                        (ScanKey) palloc(n_keys * sizeof(ScanKeyData));
                run_keys = (n_keys <= 0) ? NULL :
@@ -804,11 +804,11 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
                         */
                        clause = (OpExpr *) lfirst(qual_cell);
                        qual_cell = lnext(qual_cell);
-                       strategy = lfirsti(strategy_cell);
+                       strategy = lfirst_int(strategy_cell);
                        strategy_cell = lnext(strategy_cell);
-                       subtype = lfirsto(subtype_cell);
+                       subtype = lfirst_oid(subtype_cell);
                        subtype_cell = lnext(subtype_cell);
-                       lossy = lfirsti(lossyflag_cell);
+                       lossy = lfirst_int(lossyflag_cell);
                        lossyflag_cell = lnext(lossyflag_cell);
 
                        if (!IsA(clause, OpExpr))
@@ -892,17 +892,18 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
                                                                   scanvalue);  /* constant */
 
                        /*
-                        * If this operator is lossy, add its indxqualorig expression
-                        * to the list of quals to recheck.  The nth() calls here could
-                        * be avoided by chasing the lists in parallel to all the other
-                        * lists, but since lossy operators are very uncommon, it's
-                        * probably a waste of time to do so.
+                        * If this operator is lossy, add its indxqualorig
+                        * expression to the list of quals to recheck.  The
+                        * list_nth() calls here could be avoided by chasing the
+                        * lists in parallel to all the other lists, but since
+                        * lossy operators are very uncommon, it's probably a
+                        * waste of time to do so.
                         */
                        if (lossy)
                        {
+                               List *qualOrig = indexstate->indxqualorig;
                                lossyQuals[i] = lappend(lossyQuals[i],
-                                                                               nth(j,
-                                                                                       (List *) nth(i, indexstate->indxqualorig)));
+                                                                               list_nth((List *) list_nth(qualOrig, i), j));
                        }
                }
 
@@ -980,7 +981,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
         */
        for (i = 0; i < numIndices; i++)
        {
-               Oid                     indexOid = lfirsto(indxid_item);
+               Oid                     indexOid = lfirst_oid(indxid_item);
 
                indexDescs[i] = index_open(indexOid);
                scanDescs[i] = index_beginscan(currentRelation,
index e9ca173..03c7906 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/executor/nodeMergejoin.c,v 1.65 2004/05/26 04:41:16 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/executor/nodeMergejoin.c,v 1.66 2004/05/30 23:40:26 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -188,7 +188,7 @@ MergeCompare(List *eqQual, List *compareQual, ExprContext *econtext)
        /*
         * We can't run out of one list before the other
         */
-       Assert(length(compareQual) == length(eqQual));
+       Assert(list_length(compareQual) == list_length(eqQual));
 
        forboth(clause, compareQual, eqclause, eqQual)
        {
index d7db23b..04ef055 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/executor/nodeSubplan.c,v 1.62 2004/05/26 04:41:16 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/executor/nodeSubplan.c,v 1.63 2004/05/30 23:40:26 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -228,7 +228,7 @@ ExecScanSubPlan(SubPlanState *node,
         * calculation we have to do is done in the parent econtext, since the
         * Param values don't need to have per-query lifetime.)
         */
-       Assert(length(subplan->parParam) == length(node->args));
+       Assert(list_length(subplan->parParam) == list_length(node->args));
 
        forboth(l, subplan->parParam, pvar, node->args)
        {
@@ -341,7 +341,7 @@ ExecScanSubPlan(SubPlanState *node,
                 * For ALL, ANY, and MULTIEXPR sublinks, iterate over combining
                 * operators for columns of tuple.
                 */
-               Assert(length(node->exprs) == length(subplan->paramIds));
+               Assert(list_length(node->exprs) == list_length(subplan->paramIds));
 
                forboth(l, node->exprs, plst, subplan->paramIds)
                {
@@ -469,7 +469,7 @@ buildSubPlanHash(SubPlanState *node)
 {
        SubPlan    *subplan = (SubPlan *) node->xprstate.expr;
        PlanState  *planstate = node->planstate;
-       int                     ncols = length(node->exprs);
+       int                     ncols = list_length(node->exprs);
        ExprContext *innerecontext = node->innerecontext;
        MemoryContext tempcxt = innerecontext->ecxt_per_tuple_memory;
        MemoryContext oldcontext;
@@ -566,7 +566,7 @@ buildSubPlanHash(SubPlanState *node)
                 */
                foreach(plst, subplan->paramIds)
                {
-                       int                     paramid = lfirsti(plst);
+                       int                     paramid = lfirst_int(plst);
                        ParamExecData *prmdata;
 
                        prmdata = &(innerecontext->ecxt_param_exec_vals[paramid]);
@@ -739,7 +739,7 @@ ExecInitSubPlan(SubPlanState *node, EState *estate)
 
                foreach(lst, subplan->setParam)
                {
-                       int                     paramid = lfirsti(lst);
+                       int                     paramid = lfirst_int(lst);
                        ParamExecData *prm = &(estate->es_param_exec_vals[paramid]);
 
                        prm->execPlan = node;
@@ -773,7 +773,7 @@ ExecInitSubPlan(SubPlanState *node, EState *estate)
                /* and a short-lived exprcontext for function evaluation */
                node->innerecontext = CreateExprContext(estate);
                /* Silly little array of column numbers 1..n */
-               ncols = length(node->exprs);
+               ncols = list_length(node->exprs);
                node->keyColIdx = (AttrNumber *) palloc(ncols * sizeof(AttrNumber));
                for (i = 0; i < ncols; i++)
                        node->keyColIdx[i] = i + 1;
@@ -810,7 +810,7 @@ ExecInitSubPlan(SubPlanState *node, EState *estate)
 
                        Assert(IsA(fstate, FuncExprState));
                        Assert(IsA(opexpr, OpExpr));
-                       Assert(length(fstate->args) == 2);
+                       Assert(list_length(fstate->args) == 2);
 
                        /* Process lefthand argument */
                        exstate = (ExprState *) linitial(fstate->args);
@@ -992,7 +992,7 @@ ExecSetParamPlan(SubPlanState *node, ExprContext *econtext)
                 */
                foreach(l, subplan->setParam)
                {
-                       int                     paramid = lfirsti(l);
+                       int                     paramid = lfirst_int(l);
                        ParamExecData *prm = &(econtext->ecxt_param_exec_vals[paramid]);
 
                        prm->execPlan = NULL;
@@ -1017,7 +1017,7 @@ ExecSetParamPlan(SubPlanState *node, ExprContext *econtext)
                {
                        foreach(l, subplan->setParam)
                        {
-                               int                     paramid = lfirsti(l);
+                               int                     paramid = lfirst_int(l);
                                ParamExecData *prm = &(econtext->ecxt_param_exec_vals[paramid]);
 
                                prm->execPlan = NULL;
@@ -1091,7 +1091,7 @@ ExecReScanSetParamPlan(SubPlanState *node, PlanState *parent)
         */
        foreach(l, subplan->setParam)
        {
-               int                     paramid = lfirsti(l);
+               int                     paramid = lfirst_int(l);
                ParamExecData *prm = &(estate->es_param_exec_vals[paramid]);
 
                prm->execPlan = node;
index 0d321b0..44cef1a 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/executor/nodeTidscan.c,v 1.38 2004/05/26 04:41:16 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/executor/nodeTidscan.c,v 1.39 2004/05/30 23:40:26 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -48,7 +48,7 @@ TidListCreate(TidScanState *tidstate)
        ListCell   *l;
 
        tidList = (ItemPointerData *)
-               palloc(length(tidstate->tss_tideval) * sizeof(ItemPointerData));
+               palloc(list_length(tidstate->tss_tideval) * sizeof(ItemPointerData));
 
        foreach(l, evalList)
        {
index 4d8fade..6ec4d81 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.114 2004/05/26 04:41:16 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.115 2004/05/30 23:40:26 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -740,7 +740,7 @@ SPI_cursor_open(const char *name, void *plan, Datum *Values, const char *Nulls)
        int                     k;
 
        /* Ensure that the plan contains only one regular SELECT query */
-       if (length(ptlist) != 1 || length(qtlist) != 1)
+       if (list_length(ptlist) != 1 || list_length(qtlist) != 1)
                ereport(ERROR,
                                (errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
                                 errmsg("cannot open multi-query plan as cursor")));
@@ -821,8 +821,8 @@ SPI_cursor_open(const char *name, void *plan, Datum *Values, const char *Nulls)
        PortalDefineQuery(portal,
                                          NULL,         /* unfortunately don't have sourceText */
                                          "SELECT", /* cursor's query is always a SELECT */
-                                         makeList1(queryTree),
-                                         makeList1(planTree),
+                                         list_make1(queryTree),
+                                         list_make1(planTree),
                                          PortalGetHeapMemory(portal));
 
        MemoryContextSwitchTo(oldcontext);
@@ -951,7 +951,7 @@ SPI_is_cursor_plan(void *plan)
        }
 
        qtlist = spiplan->qtlist;
-       if (length(spiplan->ptlist) == 1 && length(qtlist) == 1)
+       if (list_length(spiplan->ptlist) == 1 && list_length(qtlist) == 1)
        {
                Query *queryTree = (Query *) linitial((List *) linitial(qtlist));
 
index f9423a4..d15e8f6 100644 (file)
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.124 2004/05/26 18:35:33 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.125 2004/05/30 23:40:26 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "postgres.h"
 
-#define DISABLE_LIST_COMPAT
-
 #include <errno.h>
 #include <pwd.h>
 #include <fcntl.h>
index a7ba5d0..f3086c8 100644 (file)
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.283 2004/05/26 13:56:47 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.284 2004/05/30 23:40:27 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
 
-#define DISABLE_LIST_COMPAT
-
 #include "postgres.h"
 
 #include "nodes/parsenodes.h"
index 97701a0..ca2511e 100644 (file)
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.222 2004/05/26 13:56:47 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.223 2004/05/30 23:40:27 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
 
-#define DISABLE_LIST_COMPAT
-
 #include "postgres.h"
 
 #include "nodes/params.h"
index 6fd7b06..f684370 100644 (file)
@@ -9,12 +9,10 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/nodes/list.c,v 1.57 2004/05/26 04:41:19 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/nodes/list.c,v 1.58 2004/05/30 23:40:27 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
-#define DISABLE_LIST_COMPAT
-
 #include "postgres.h"
 #include "nodes/pg_list.h"
 
index 8842bd4..60dd8fb 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/nodes/makefuncs.c,v 1.43 2004/05/10 22:44:44 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/nodes/makefuncs.c,v 1.44 2004/05/30 23:40:27 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -47,7 +47,7 @@ makeSimpleA_Expr(A_Expr_Kind kind, const char *name,
        A_Expr     *a = makeNode(A_Expr);
 
        a->kind = kind;
-       a->name = makeList1(makeString((char *) name));
+       a->name = list_make1(makeString((char *) name));
        a->lexpr = lexpr;
        a->rexpr = rexpr;
        return a;
@@ -259,7 +259,7 @@ makeTypeName(char *typnam)
 {
        TypeName   *n = makeNode(TypeName);
 
-       n->names = makeList1(makeString(typnam));
+       n->names = list_make1(makeString(typnam));
        n->typmod = -1;
        return n;
 }
index f9e3f7f..cb6964c 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.237 2004/05/26 04:41:19 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.238 2004/05/30 23:40:27 neilc Exp $
  *
  * NOTES
  *       Every node type that can appear in stored rules' parsetrees *must*
@@ -19,8 +19,6 @@
  *
  *-------------------------------------------------------------------------
  */
-#define DISABLE_LIST_COMPAT
-
 #include "postgres.h"
 
 #include <ctype.h>
index 8da0726..4934c09 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/nodes/print.c,v 1.67 2004/05/26 04:41:19 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/nodes/print.c,v 1.68 2004/05/30 23:40:27 neilc Exp $
  *
  * HISTORY
  *       AUTHOR                        DATE                    MAJOR EVENT
@@ -333,7 +333,7 @@ print_expr(Node *expr, List *rtable)
                                        RangeTblEntry *rte;
 
                                        Assert(var->varno > 0 &&
-                                                  (int) var->varno <= length(rtable));
+                                                  (int) var->varno <= list_length(rtable));
                                        rte = rt_fetch(var->varno, rtable);
                                        relname = rte->eref->aliasname;
                                        attname = get_rte_attribute_name(rte, var->varattno);
@@ -378,7 +378,7 @@ print_expr(Node *expr, List *rtable)
                char       *opname;
 
                opname = get_opname(e->opno);
-               if (length(e->args) > 1)
+               if (list_length(e->args) > 1)
                {
                        print_expr(get_leftop((Expr *) e), rtable);
                        printf(" %s ", ((opname != NULL) ? opname : "(invalid operator)"));
index 6822909..244b9e1 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/nodes/read.c,v 1.42 2004/05/26 04:41:19 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/nodes/read.c,v 1.43 2004/05/30 23:40:27 neilc Exp $
  *
  * HISTORY
  *       AUTHOR                        DATE                    MAJOR EVENT
@@ -327,7 +327,7 @@ nodeRead(char *token, int tok_len)
                                                if (endptr != token + tok_len)
                                                        elog(ERROR, "unrecognized integer: \"%.*s\"",
                                                                 tok_len, token);
-                                               l = lappendi(l, val);
+                                               l = lappend_int(l, val);
                                        }
                                }
                                else if (tok_len == 1 && token[0] == 'o')
@@ -347,7 +347,7 @@ nodeRead(char *token, int tok_len)
                                                if (endptr != token + tok_len)
                                                        elog(ERROR, "unrecognized OID: \"%.*s\"",
                                                                 tok_len, token);
-                                               l = lappendo(l, val);
+                                               l = lappend_oid(l, val);
                                        }
                                }
                                else
index 792a615..225bf62 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.170 2004/05/26 04:41:19 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.171 2004/05/30 23:40:27 neilc Exp $
  *
  * NOTES
  *       Path and Plan nodes do not have any readfuncs support, because we
@@ -18,8 +18,6 @@
  *
  *-------------------------------------------------------------------------
  */
-#define DISABLE_LIST_COMPAT
-
 #include "postgres.h"
 
 #include <math.h>
index 1642f34..2877a28 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.68 2004/05/26 04:41:20 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.69 2004/05/30 23:40:27 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -175,8 +175,8 @@ gimme_tree(Gene *tour, int num_gene, GeqoEvalData *evaldata)
 
                /* Get the next input relation and push it */
                cur_rel_index = (int) tour[rel_count];
-               stack[stack_depth] = (RelOptInfo *) nth(cur_rel_index - 1,
-                                                                                               evaldata->initial_rels);
+               stack[stack_depth] = (RelOptInfo *) list_nth(evaldata->initial_rels,
+                                                                                                        cur_rel_index - 1);
                stack_depth++;
 
                /*
index a4bc92b..6dea338 100644 (file)
@@ -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;
index c8b54bf..e736c6e 100644 (file)
@@ -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);
                        }
index 71b879b..96d0e21 100644 (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.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;
index 7c72b54..d0ba690 100644 (file)
@@ -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 )" */
 
index e854fe0..e41ff33 100644 (file)
@@ -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);
index 6debd82..987b98b 100644 (file)
@@ -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);
                        }
                }
index cc160e7..2071054 100644 (file)
@@ -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
index af232bd..2fd3a99 100644 (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.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);
 }
index dcb6566..51e8d12 100644 (file)
@@ -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;
                        }
index efa7dd7..719ca63 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.170 2004/05/26 04:41:24 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.171 2004/05/30 23:40:28 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -395,7 +395,7 @@ create_join_plan(Query *root, JoinPath *best_path)
         */
        if (get_loc_restrictinfo(best_path) != NIL)
                set_qpqual((Plan) plan,
-                                  nconc(get_qpqual((Plan) plan),
+                                  list_concat(get_qpqual((Plan) plan),
                                   get_actual_clauses(get_loc_restrictinfo(best_path))));
 #endif
 
@@ -548,12 +548,12 @@ create_unique_plan(Query *root, UniquePath *best_path)
                elog(ERROR, "could not find UniquePath in in_info_list");
 
        /* set up to record positions of unique columns */
-       numGroupCols = length(uniq_exprs);
+       numGroupCols = list_length(uniq_exprs);
        groupColIdx = (AttrNumber *) palloc(numGroupCols * sizeof(AttrNumber));
        groupColPos = 0;
        /* not sure if tlist might be shared with other nodes, so copy */
        newtlist = copyObject(subplan->targetlist);
-       nextresno = length(newtlist) + 1;
+       nextresno = list_length(newtlist) + 1;
        newitems = false;
 
        foreach(l, uniq_exprs)
@@ -725,9 +725,9 @@ create_indexscan_plan(Query *root,
                 * need to worry about the plain AND case.  Also, pointer comparison
                 * should be enough to determine RestrictInfo matches.
                 */
-               Assert(length(best_path->indexclauses) == 1);
-               scan_clauses = set_ptrUnion(scan_clauses,
-                                                                       (List *) linitial(best_path->indexclauses));
+               Assert(list_length(best_path->indexclauses) == 1);
+               scan_clauses = list_union_ptr(scan_clauses,
+                                                                         (List *) linitial(best_path->indexclauses));
        }
 
        /* Reduce RestrictInfo list to bare expressions */
@@ -766,7 +766,7 @@ create_indexscan_plan(Query *root,
         * added to qpqual.  The upshot is that qpquals must contain scan_clauses
         * minus whatever appears in indxquals.
         */
-       if (length(indxquals) > 1)
+       if (list_length(indxquals) > 1)
        {
                /*
                 * Build an expression representation of the indexqual, expanding
@@ -775,7 +775,7 @@ create_indexscan_plan(Query *root,
                 * scan_clause are not great; perhaps we need more smarts here.)
                 */
                indxqual_or_expr = make_expr_from_indexclauses(indxquals);
-               qpqual = set_difference(scan_clauses, makeList1(indxqual_or_expr));
+               qpqual = list_difference(scan_clauses, list_make1(indxqual_or_expr));
        }
        else
        {
@@ -785,7 +785,7 @@ create_indexscan_plan(Query *root,
                 * behavior.
                 */
                Assert(stripped_indxquals != NIL);
-               qpqual = set_difference(scan_clauses, linitial(stripped_indxquals));
+               qpqual = list_difference(scan_clauses, linitial(stripped_indxquals));
        }
 
        /*
@@ -950,7 +950,7 @@ create_nestloop_plan(Query *root,
                List       *indexclauses = innerpath->indexclauses;
 
                if (innerpath->isjoininner &&
-                       length(indexclauses) == 1)              /* single indexscan? */
+                       list_length(indexclauses) == 1)         /* single indexscan? */
                {
                        joinrestrictclauses =
                                select_nonredundant_join_clauses(root,
@@ -1019,7 +1019,7 @@ create_mergejoin_plan(Query *root,
         * the list of quals that must be checked as qpquals.
         */
        mergeclauses = get_actual_clauses(best_path->path_mergeclauses);
-       joinclauses = set_difference(joinclauses, mergeclauses);
+       joinclauses = list_difference(joinclauses, mergeclauses);
 
        /*
         * Rearrange mergeclauses, if needed, so that the outer variable is
@@ -1103,7 +1103,7 @@ create_hashjoin_plan(Query *root,
         * the list of quals that must be checked as qpquals.
         */
        hashclauses = get_actual_clauses(best_path->path_hashclauses);
-       joinclauses = set_difference(joinclauses, hashclauses);
+       joinclauses = list_difference(joinclauses, hashclauses);
 
        /*
         * Rearrange hashclauses, if needed, so that the outer variable is
@@ -1248,7 +1248,7 @@ fix_indxqual_sublist(List *indexqual,
 
                Assert(IsA(rinfo, RestrictInfo));
                clause = (OpExpr *) rinfo->clause;
-               if (!IsA(clause, OpExpr) || length(clause->args) != 2)
+               if (!IsA(clause, OpExpr) || list_length(clause->args) != 2)
                        elog(ERROR, "indexqual clause is not binary opclause");
 
                /*
@@ -1287,9 +1287,9 @@ fix_indxqual_sublist(List *indexqual,
                get_op_opclass_properties(newclause->opno, opclass,
                                                                  &stratno, &stratsubtype, &recheck);
 
-               *strategy = lappendi(*strategy, stratno);
-               *subtype = lappendo(*subtype, stratsubtype);
-               *lossy = lappendi(*lossy, (int) recheck);
+               *strategy = lappend_int(*strategy, stratno);
+               *subtype = lappend_oid(*subtype, stratsubtype);
+               *lossy = lappend_int(*lossy, (int) recheck);
        }
 }
 
@@ -1401,7 +1401,7 @@ get_switched_clauses(List *clauses, Relids outerrelids)
                        temp->opfuncid = InvalidOid;
                        temp->opresulttype = clause->opresulttype;
                        temp->opretset = clause->opretset;
-                       temp->args = listCopy(clause->args);
+                       temp->args = list_copy(clause->args);
                        /* Commute it --- note this modifies the temp node in-place. */
                        CommuteClause(temp);
                        t_list = lappend(t_list, temp);
@@ -1839,8 +1839,8 @@ make_sort_from_pathkeys(Query *root, Plan *lefttree, List *pathkeys)
        AttrNumber *sortColIdx;
        Oid                *sortOperators;
 
-       /* We will need at most length(pathkeys) sort columns; possibly less */
-       numsortkeys = length(pathkeys);
+       /* We will need at most list_length(pathkeys) sort columns; possibly less */
+       numsortkeys = list_length(pathkeys);
        sortColIdx = (AttrNumber *) palloc(numsortkeys * sizeof(AttrNumber));
        sortOperators = (Oid *) palloc(numsortkeys * sizeof(Oid));
 
@@ -1888,7 +1888,7 @@ make_sort_from_pathkeys(Query *root, Plan *lefttree, List *pathkeys)
                                        if (!tlist_member(lfirst(k), tlist))
                                                break;
                                }
-                               freeList(exprvars);
+                               list_free(exprvars);
                                if (!k)
                                        break;          /* found usable expression */
                        }
@@ -1907,7 +1907,7 @@ make_sort_from_pathkeys(Query *root, Plan *lefttree, List *pathkeys)
                        /*
                         * Add resjunk entry to input's tlist
                         */
-                       resdom = makeResdom(length(tlist) + 1,
+                       resdom = makeResdom(list_length(tlist) + 1,
                                                                exprType(pathkey->key),
                                                                exprTypmod(pathkey->key),
                                                                NULL,
@@ -1950,8 +1950,8 @@ make_sort_from_sortclauses(Query *root, List *sortcls, Plan *lefttree)
        AttrNumber *sortColIdx;
        Oid                *sortOperators;
 
-       /* We will need at most length(sortcls) sort columns; possibly less */
-       numsortkeys = length(sortcls);
+       /* We will need at most list_length(sortcls) sort columns; possibly less */
+       numsortkeys = list_length(sortcls);
        sortColIdx = (AttrNumber *) palloc(numsortkeys * sizeof(AttrNumber));
        sortOperators = (Oid *) palloc(numsortkeys * sizeof(Oid));
 
@@ -2003,8 +2003,8 @@ make_sort_from_groupcols(Query *root,
        AttrNumber *sortColIdx;
        Oid                *sortOperators;
 
-       /* We will need at most length(groupcls) sort columns; possibly less */
-       numsortkeys = length(groupcls);
+       /* We will need at most list_length(groupcls) sort columns; possibly less */
+       numsortkeys = list_length(groupcls);
        sortColIdx = (AttrNumber *) palloc(numsortkeys * sizeof(AttrNumber));
        sortOperators = (Oid *) palloc(numsortkeys * sizeof(Oid));
 
@@ -2207,7 +2207,7 @@ make_unique(Plan *lefttree, List *distinctList)
 {
        Unique     *node = makeNode(Unique);
        Plan       *plan = &node->plan;
-       int                     numCols = length(distinctList);
+       int                     numCols = list_length(distinctList);
        int                     keyno = 0;
        AttrNumber *uniqColIdx;
        ListCell   *slitem;
@@ -2264,7 +2264,7 @@ make_setop(SetOpCmd cmd, Plan *lefttree,
 {
        SetOp      *node = makeNode(SetOp);
        Plan       *plan = &node->plan;
-       int                     numCols = length(distinctList);
+       int                     numCols = list_length(distinctList);
        int                     keyno = 0;
        AttrNumber *dupColIdx;
        ListCell   *slitem;
index f8a4bfa..d245f3d 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.99 2004/05/26 04:41:24 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.100 2004/05/30 23:40:29 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -121,7 +121,7 @@ build_base_rel_tlists(Query *root, List *final_tlist)
        if (tlist_vars != NIL)
        {
                add_vars_to_targetlist(root, tlist_vars, bms_make_singleton(0));
-               freeList(tlist_vars);
+               list_free(tlist_vars);
        }
 }
 
@@ -333,7 +333,7 @@ mark_baserels_for_outer_join(Query *root, Relids rels, Relids outerrels)
                 */
                if (rel->outerjoinset == NULL)
                {
-                       if (intMember(relno, root->rowMarks))
+                       if (list_member_int(root->rowMarks, relno))
                                ereport(ERROR,
                                                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                                                 errmsg("SELECT FOR UPDATE cannot be applied to the nullable side of an outer join")));
@@ -585,7 +585,7 @@ distribute_qual_to_rels(Query *root, Node *clause,
                         */
                        vars = pull_var_clause(clause, false);
                        add_vars_to_targetlist(root, vars, relids);
-                       freeList(vars);
+                       list_free(vars);
                        break;
                default:
 
@@ -705,8 +705,8 @@ process_implied_equality(Query *root,
                                if (membership == BMS_SINGLETON)
                                {
                                        /* delete it from local restrictinfo list */
-                                       rel1->baserestrictinfo = lremove(restrictinfo,
-                                                                                                rel1->baserestrictinfo);
+                                       rel1->baserestrictinfo = list_delete_ptr(rel1->baserestrictinfo,
+                                                                                                                        restrictinfo);
                                }
                                else
                                {
@@ -728,7 +728,7 @@ process_implied_equality(Query *root,
         */
        ltype = exprType(item1);
        rtype = exprType(item2);
-       eq_operator = compatible_oper(makeList1(makeString("=")),
+       eq_operator = compatible_oper(list_make1(makeString("=")),
                                                                  ltype, rtype, true);
        if (!HeapTupleIsValid(eq_operator))
        {
@@ -854,11 +854,11 @@ qual_is_redundant(Query *root,
         * done.  We give up when we can't expand the equalexprs list any
         * more.
         */
-       equalexprs = makeList1(newleft);
+       equalexprs = list_make1(newleft);
        do
        {
                someadded = false;
-               /* cannot use foreach here because of possible lremove */
+               /* cannot use foreach here because of possible list_delete */
                olditem = list_head(oldquals);
                while (olditem)
                {
@@ -867,12 +867,12 @@ qual_is_redundant(Query *root,
                        Node       *oldright = get_rightop(oldrinfo->clause);
                        Node       *newguy = NULL;
 
-                       /* must advance olditem before lremove possibly pfree's it */
+                       /* must advance olditem before list_delete possibly pfree's it */
                        olditem = lnext(olditem);
 
-                       if (member(oldleft, equalexprs))
+                       if (list_member(equalexprs, oldleft))
                                newguy = oldright;
-                       else if (member(oldright, equalexprs))
+                       else if (list_member(equalexprs, oldright))
                                newguy = oldleft;
                        else
                                continue;
@@ -884,7 +884,7 @@ qual_is_redundant(Query *root,
                        /*
                         * Remove this qual from list, since we don't need it anymore.
                         */
-                       oldquals = lremove(oldrinfo, oldquals);
+                       oldquals = list_delete_ptr(oldquals, oldrinfo);
                }
        } while (someadded);
 
@@ -917,7 +917,7 @@ check_mergejoinable(RestrictInfo *restrictinfo)
 
        if (!is_opclause(clause))
                return;
-       if (length(((OpExpr *) clause)->args) != 2)
+       if (list_length(((OpExpr *) clause)->args) != 2)
                return;
 
        opno = ((OpExpr *) clause)->opno;
@@ -950,7 +950,7 @@ check_hashjoinable(RestrictInfo *restrictinfo)
 
        if (!is_opclause(clause))
                return;
-       if (length(((OpExpr *) clause)->args) != 2)
+       if (list_length(((OpExpr *) clause)->args) != 2)
                return;
 
        opno = ((OpExpr *) clause)->opno;
index 7b5d44c..064981b 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.170 2004/05/26 04:41:24 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.171 2004/05/30 23:40:29 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -131,7 +131,7 @@ planner(Query *parse, bool isCursor, int cursorOptions)
        }
 
        /* executor wants to know total number of Params used overall */
-       result_plan->nParamExec = length(PlannerParamList);
+       result_plan->nParamExec = list_length(PlannerParamList);
 
        /* final cleanup of the plan */
        set_plan_references(result_plan, parse->rtable);
@@ -493,14 +493,14 @@ inheritance_planner(Query *parse, List *inheritlist)
 {
        int                     parentRTindex = parse->resultRelation;
        Oid                     parentOID = getrelid(parentRTindex, parse->rtable);
-       int                     mainrtlength = length(parse->rtable);
+       int                     mainrtlength = list_length(parse->rtable);
        List       *subplans = NIL;
        List       *tlist = NIL;
        ListCell   *l;
 
        foreach(l, inheritlist)
        {
-               int                     childRTindex = lfirsti(l);
+               int                     childRTindex = lfirst_int(l);
                Oid                     childOID = getrelid(childRTindex, parse->rtable);
                int                     subrtlength;
                Query      *subquery;
@@ -522,13 +522,13 @@ inheritance_planner(Query *parse, List *inheritlist)
                 * XXX my goodness this is ugly.  Really need to think about ways to
                 * rein in planner's habit of scribbling on its input.
                 */
-               subrtlength = length(subquery->rtable);
+               subrtlength = list_length(subquery->rtable);
                if (subrtlength > mainrtlength)
                {
                        List       *subrt;
 
                        subrt = list_copy_tail(subquery->rtable, mainrtlength);
-                       parse->rtable = nconc(parse->rtable, subrt);
+                       parse->rtable = list_concat(parse->rtable, subrt);
                        mainrtlength = subrtlength;
                }
                /* Save preprocessed tlist from first rel for use in Append */
@@ -634,7 +634,7 @@ grouping_planner(Query *parse, double tuple_fraction)
                double          dNumGroups = 0;
                long            numGroups = 0;
                int                     numAggs = 0;
-               int                     numGroupCols = length(parse->groupClause);
+               int                     numGroupCols = list_length(parse->groupClause);
                bool            use_hashed_grouping = false;
 
                /* Preprocess targetlist in case we are inside an INSERT/UPDATE. */
@@ -672,7 +672,7 @@ grouping_planner(Query *parse, double tuple_fraction)
 
                        foreach(l, parse->rowMarks)
                        {
-                               Index           rti = lfirsti(l);
+                               Index           rti = lfirst_int(l);
                                char       *resname;
                                Resdom     *resdom;
                                Var                *var;
@@ -680,7 +680,7 @@ grouping_planner(Query *parse, double tuple_fraction)
 
                                resname = (char *) palloc(32);
                                snprintf(resname, 32, "ctid%u", rti);
-                               resdom = makeResdom(length(tlist) + 1,
+                               resdom = makeResdom(list_length(tlist) + 1,
                                                                        TIDOID,
                                                                        -1,
                                                                        resname,
@@ -1421,7 +1421,7 @@ make_subplanTargetList(Query *parse,
        sub_tlist = flatten_tlist(tlist);
        extravars = pull_var_clause(parse->havingQual, false);
        sub_tlist = add_to_flat_tlist(sub_tlist, extravars);
-       freeList(extravars);
+       list_free(extravars);
        *need_tlist_eval = false;       /* only eval if not flat tlist */
 
        /*
@@ -1430,7 +1430,7 @@ make_subplanTargetList(Query *parse,
         * already), and make an array showing where the group columns are in
         * the sub_tlist.
         */
-       numCols = length(parse->groupClause);
+       numCols = list_length(parse->groupClause);
        if (numCols > 0)
        {
                int                     keyno = 0;
@@ -1456,7 +1456,7 @@ make_subplanTargetList(Query *parse,
                        }
                        if (!sl)
                        {
-                               te = makeTargetEntry(makeResdom(length(sub_tlist) + 1,
+                               te = makeTargetEntry(makeResdom(list_length(sub_tlist) + 1,
                                                                                                exprType(groupexpr),
                                                                                                exprTypmod(groupexpr),
                                                                                                NULL,
index 9245da8..1d5b810 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/plan/subselect.c,v 1.90 2004/05/26 04:41:24 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/plan/subselect.c,v 1.91 2004/05/30 23:40:29 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -191,7 +191,7 @@ replace_outer_agg(Aggref *agg)
        pitem->abslevel = abslevel;
 
        PlannerParamList = lappend(PlannerParamList, pitem);
-       i = length(PlannerParamList) - 1;
+       i = list_length(PlannerParamList) - 1;
 
        retval = makeNode(Param);
        retval->paramkind = PARAM_EXEC;
@@ -216,7 +216,7 @@ generate_new_param(Oid paramtype, int32 paramtypmod)
 
        retval = makeNode(Param);
        retval->paramkind = PARAM_EXEC;
-       retval->paramid = (AttrNumber) length(PlannerParamList);
+       retval->paramid = (AttrNumber) list_length(PlannerParamList);
        retval->paramtype = paramtype;
 
        pitem = (PlannerParamItem *) palloc(sizeof(PlannerParamItem));
@@ -320,10 +320,10 @@ make_subplan(SubLink *slink, List *lefthand, bool isTopQual)
        tmpset = bms_copy(plan->extParam);
        while ((paramid = bms_first_member(tmpset)) >= 0)
        {
-               PlannerParamItem *pitem = nth(paramid, PlannerParamList);
+               PlannerParamItem *pitem = list_nth(PlannerParamList, paramid);
 
                if (pitem->abslevel == PlannerQueryLevel)
-                       node->parParam = lappendi(node->parParam, paramid);
+                       node->parParam = lappend_int(node->parParam, paramid);
        }
        bms_free(tmpset);
 
@@ -341,7 +341,7 @@ make_subplan(SubLink *slink, List *lefthand, bool isTopQual)
                Param      *prm;
 
                prm = generate_new_param(BOOLOID, -1);
-               node->setParam = makeListi1(prm->paramid);
+               node->setParam = list_make1_int(prm->paramid);
                PlannerInitPlan = lappend(PlannerInitPlan, node);
                result = (Node *) prm;
        }
@@ -352,7 +352,7 @@ make_subplan(SubLink *slink, List *lefthand, bool isTopQual)
 
                Assert(!te->resdom->resjunk);
                prm = generate_new_param(te->resdom->restype, te->resdom->restypmod);
-               node->setParam = makeListi1(prm->paramid);
+               node->setParam = list_make1_int(prm->paramid);
                PlannerInitPlan = lappend(PlannerInitPlan, node);
                result = (Node *) prm;
        }
@@ -368,7 +368,7 @@ make_subplan(SubLink *slink, List *lefthand, bool isTopQual)
                        elog(ERROR, "could not find array type for datatype %s",
                                 format_type_be(te->resdom->restype));
                prm = generate_new_param(arraytype, -1);
-               node->setParam = makeListi1(prm->paramid);
+               node->setParam = list_make1_int(prm->paramid);
                PlannerInitPlan = lappend(PlannerInitPlan, node);
                result = (Node *) prm;
        }
@@ -382,7 +382,7 @@ make_subplan(SubLink *slink, List *lefthand, bool isTopQual)
                                                                          plan->targetlist,
                                                                          0,
                                                                          &node->paramIds);
-               node->setParam = listCopy(node->paramIds);
+               node->setParam = list_copy(node->paramIds);
                PlannerInitPlan = lappend(PlannerInitPlan, node);
 
                /*
@@ -390,7 +390,7 @@ make_subplan(SubLink *slink, List *lefthand, bool isTopQual)
                 * outer plan's expression tree; they are not kept in the initplan
                 * node.
                 */
-               if (length(exprs) > 1)
+               if (list_length(exprs) > 1)
                        result = (Node *) (node->useOr ? make_orclause(exprs) :
                                                           make_andclause(exprs));
                else
@@ -473,7 +473,7 @@ make_subplan(SubLink *slink, List *lefthand, bool isTopQual)
                args = NIL;
                foreach(l, node->parParam)
                {
-                       PlannerParamItem *pitem = nth(lfirsti(l), PlannerParamList);
+                       PlannerParamItem *pitem = list_nth(PlannerParamList, lfirst_int(l));
 
                        /*
                         * The Var or Aggref has already been adjusted to have the
@@ -517,7 +517,7 @@ convert_sublink_opers(List *lefthand, List *operOids,
 
        foreach(l, operOids)
        {
-               Oid                     opid = lfirsto(l);
+               Oid                     opid = lfirst_oid(l);
                Node       *leftop = (Node *) lfirst(lefthand_item);
                TargetEntry *te = (TargetEntry *) lfirst(tlist_item);
                Node       *rightop;
@@ -547,7 +547,7 @@ convert_sublink_opers(List *lefthand, List *operOids,
                        prm = generate_new_param(te->resdom->restype,
                                                                         te->resdom->restypmod);
                        /* Record its ID */
-                       *righthandIds = lappendi(*righthandIds, prm->paramid);
+                       *righthandIds = lappend_int(*righthandIds, prm->paramid);
                        rightop = (Node *) prm;
                }
 
@@ -603,7 +603,7 @@ subplan_is_hashable(SubLink *slink, SubPlan *node)
         */
        if (slink->subLinkType != ANY_SUBLINK)
                return false;
-       if (length(slink->operName) != 1 ||
+       if (list_length(slink->operName) != 1 ||
                strcmp(strVal(linitial(slink->operName)), "=") != 0)
                return false;
 
@@ -640,7 +640,7 @@ subplan_is_hashable(SubLink *slink, SubPlan *node)
         */
        foreach(l, slink->operOids)
        {
-               Oid                     opid = lfirsto(l);
+               Oid                     opid = lfirst_oid(l);
                HeapTuple       tup;
                Form_pg_operator optup;
 
@@ -691,7 +691,7 @@ convert_IN_to_join(Query *parse, SubLink *sublink)
         */
        if (sublink->subLinkType != ANY_SUBLINK)
                return NULL;
-       if (length(sublink->operName) != 1 ||
+       if (list_length(sublink->operName) != 1 ||
                strcmp(strVal(linitial(sublink->operName)), "=") != 0)
                return NULL;
 
@@ -731,7 +731,7 @@ convert_IN_to_join(Query *parse, SubLink *sublink)
                                                                                makeAlias("IN_subquery", NIL),
                                                                                false);
        parse->rtable = lappend(parse->rtable, rte);
-       rtindex = length(parse->rtable);
+       rtindex = list_length(parse->rtable);
        rtr = makeNode(RangeTblRef);
        rtr->rtindex = rtindex;
        parse->jointree->fromlist = lappend(parse->jointree->fromlist, rtr);
@@ -874,7 +874,7 @@ process_sublinks_mutator(Node *node, bool *isTopQual)
                        newarg = process_sublinks_mutator(lfirst(l),
                                                                                          (void *) &locTopQual);
                        if (and_clause(newarg))
-                               newargs = nconc(newargs, ((BoolExpr *) newarg)->args);
+                               newargs = list_concat(newargs, ((BoolExpr *) newarg)->args);
                        else
                                newargs = lappend(newargs, newarg);
                }
@@ -896,7 +896,7 @@ process_sublinks_mutator(Node *node, bool *isTopQual)
                        newarg = process_sublinks_mutator(lfirst(l),
                                                                                          (void *) &locTopQual);
                        if (or_clause(newarg))
-                               newargs = nconc(newargs, ((BoolExpr *) newarg)->args);
+                               newargs = list_concat(newargs, ((BoolExpr *) newarg)->args);
                        else
                                newargs = lappend(newargs, newarg);
                }
index 37c6e96..1eb4d55 100644 (file)
@@ -16,7 +16,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.19 2004/05/26 18:35:41 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.20 2004/05/30 23:40:29 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -224,7 +224,7 @@ pull_up_subqueries(Query *parse, Node *jtnode, bool below_outer_join)
                         * Adjust level-0 varnos in subquery so that we can append its
                         * rangetable to upper query's.
                         */
-                       rtoffset = length(parse->rtable);
+                       rtoffset = list_length(parse->rtable);
                        OffsetVarNodes((Node *) subquery, rtoffset, 0);
 
                        /*
@@ -269,14 +269,14 @@ pull_up_subqueries(Query *parse, Node *jtnode, bool below_outer_join)
                         * hold off until after fixing the upper rtable entries; no
                         * point in running that code on the subquery ones too.)
                         */
-                       parse->rtable = nconc(parse->rtable, subquery->rtable);
+                       parse->rtable = list_concat(parse->rtable, subquery->rtable);
 
                        /*
                         * Pull up any FOR UPDATE markers, too.  (OffsetVarNodes
-                        * already adjusted the marker values, so just nconc the
-                        * list.)
+                        * already adjusted the marker values, so just list_concat
+                        * the list.)
                         */
-                       parse->rowMarks = nconc(parse->rowMarks, subquery->rowMarks);
+                       parse->rowMarks = list_concat(parse->rowMarks, subquery->rowMarks);
 
                        /*
                         * We also have to fix the relid sets of any parent
@@ -295,8 +295,8 @@ pull_up_subqueries(Query *parse, Node *jtnode, bool below_outer_join)
                        /*
                         * And now append any subquery InClauseInfos to our list.
                         */
-                       parse->in_info_list = nconc(parse->in_info_list,
-                                                                               subquery->in_info_list);
+                       parse->in_info_list = list_concat(parse->in_info_list,
+                                                                                         subquery->in_info_list);
 
                        /*
                         * Miscellaneous housekeeping.
@@ -662,7 +662,7 @@ reduce_outer_joins_pass2(Node *jtnode,
                pass_nonnullable = bms_add_members(pass_nonnullable,
                                                                                   nonnullable_rels);
                /* And recurse --- but only into interesting subtrees */
-               Assert(length(f->fromlist) == length(state->sub_states));
+               Assert(list_length(f->fromlist) == list_length(state->sub_states));
                forboth(l, f->fromlist, s, state->sub_states)
                {
                        reduce_outer_joins_state *sub_state = lfirst(s);
@@ -919,20 +919,20 @@ simplify_jointree(Query *parse, Node *jtnode)
                                 * from_collapse_limit.
                                 */
                                FromExpr   *subf = (FromExpr *) child;
-                               int                     childlen = length(subf->fromlist);
-                               int                     myothers = length(newlist) + children_remaining;
+                               int                     childlen = list_length(subf->fromlist);
+                               int                     myothers = list_length(newlist) + children_remaining;
 
                                if (childlen <= 1 ||
                                        (childlen + myothers) <= from_collapse_limit)
                                {
-                                       newlist = nconc(newlist, subf->fromlist);
+                                       newlist = list_concat(newlist, subf->fromlist);
 
                                        /*
                                         * By now, the quals have been converted to
                                         * implicit-AND lists, so we just need to join the
                                         * lists.  NOTE: we put the pulled-up quals first.
                                         */
-                                       f->quals = (Node *) nconc((List *) subf->quals,
+                                       f->quals = (Node *) list_concat((List *) subf->quals,
                                                                                          (List *) f->quals);
                                }
                                else
@@ -963,11 +963,11 @@ simplify_jointree(Query *parse, Node *jtnode)
                                                rightlen;
 
                        if (j->larg && IsA(j->larg, FromExpr))
-                               leftlen = length(((FromExpr *) j->larg)->fromlist);
+                               leftlen = list_length(((FromExpr *) j->larg)->fromlist);
                        else
                                leftlen = 1;
                        if (j->rarg && IsA(j->rarg, FromExpr))
-                               rightlen = length(((FromExpr *) j->rarg)->fromlist);
+                               rightlen = list_length(((FromExpr *) j->rarg)->fromlist);
                        else
                                rightlen = 1;
                        if ((leftlen + rightlen) <= join_collapse_limit)
@@ -985,22 +985,22 @@ simplify_jointree(Query *parse, Node *jtnode)
                                        f->quals = subf->quals;
                                }
                                else
-                                       f->fromlist = makeList1(j->larg);
+                                       f->fromlist = list_make1(j->larg);
 
                                if (j->rarg && IsA(j->rarg, FromExpr))
                                {
                                        FromExpr   *subf = (FromExpr *) j->rarg;
 
-                                       f->fromlist = nconc(f->fromlist,
-                                                                               subf->fromlist);
-                                       f->quals = (Node *) nconc((List *) f->quals,
+                                       f->fromlist = list_concat(f->fromlist,
+                                                                                         subf->fromlist);
+                                       f->quals = (Node *) list_concat((List *) f->quals,
                                                                                          (List *) subf->quals);
                                }
                                else
                                        f->fromlist = lappend(f->fromlist, j->rarg);
 
                                /* pulled-up quals first */
-                               f->quals = (Node *) nconc((List *) f->quals,
+                               f->quals = (Node *) list_concat((List *) f->quals,
                                                                                  (List *) j->quals);
 
                                return (Node *) f;
index 1cfafe5..2f4a512 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/prep/prepqual.c,v 1.42 2004/05/26 04:41:26 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/prep/prepqual.c,v 1.43 2004/05/30 23:40:29 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -445,7 +445,7 @@ process_duplicate_ors(List *orlist)
 
        if (orlist == NIL)
                return NULL;                    /* probably can't happen */
-       if (length(orlist) == 1)        /* single-expression OR (can this happen?) */
+       if (list_length(orlist) == 1)   /* single-expression OR (can this happen?) */
                return linitial(orlist);
 
        /*
@@ -461,7 +461,7 @@ process_duplicate_ors(List *orlist)
                if (and_clause((Node *) clause))
                {
                        List       *subclauses = ((BoolExpr *) clause)->args;
-                       int                     nclauses = length(subclauses);
+                       int                     nclauses = list_length(subclauses);
 
                        if (reference == NIL || nclauses < num_subclauses)
                        {
@@ -471,7 +471,7 @@ process_duplicate_ors(List *orlist)
                }
                else
                {
-                       reference = makeList1(clause);
+                       reference = list_make1(clause);
                        break;
                }
        }
@@ -479,7 +479,7 @@ process_duplicate_ors(List *orlist)
        /*
         * Just in case, eliminate any duplicates in the reference list.
         */
-       reference = set_union(NIL, reference);
+       reference = list_union(NIL, reference);
 
        /*
         * Check each element of the reference list to see if it's in all the
@@ -498,7 +498,7 @@ process_duplicate_ors(List *orlist)
 
                        if (and_clause((Node *) clause))
                        {
-                               if (!member(refclause, ((BoolExpr *) clause)->args))
+                               if (!list_member(((BoolExpr *) clause)->args, refclause))
                                {
                                        win = false;
                                        break;
@@ -531,7 +531,7 @@ process_duplicate_ors(List *orlist)
         * (A AND B) OR (A), which can be reduced to just A --- that is, the
         * additional conditions in other arms of the OR are irrelevant.
         *
-        * Note that because we use set_difference, any multiple occurrences of
+        * Note that because we use list_difference, any multiple occurrences of
         * a winning clause in an AND sub-clause will be removed automatically.
         */
        neworlist = NIL;
@@ -543,10 +543,10 @@ process_duplicate_ors(List *orlist)
                {
                        List       *subclauses = ((BoolExpr *) clause)->args;
 
-                       subclauses = set_difference(subclauses, winners);
+                       subclauses = list_difference(subclauses, winners);
                        if (subclauses != NIL)
                        {
-                               if (length(subclauses) == 1)
+                               if (list_length(subclauses) == 1)
                                        neworlist = lappend(neworlist, linitial(subclauses));
                                else
                                        neworlist = lappend(neworlist, make_andclause(subclauses));
@@ -559,7 +559,7 @@ process_duplicate_ors(List *orlist)
                }
                else
                {
-                       if (!member(clause, winners))
+                       if (!list_member(winners, clause))
                                neworlist = lappend(neworlist, clause);
                        else
                        {
@@ -577,7 +577,7 @@ process_duplicate_ors(List *orlist)
         */
        if (neworlist != NIL)
        {
-               if (length(neworlist) == 1)
+               if (list_length(neworlist) == 1)
                        winners = lappend(winners, linitial(neworlist));
                else
                        winners = lappend(winners, make_orclause(pull_ors(neworlist)));
@@ -587,7 +587,7 @@ process_duplicate_ors(List *orlist)
         * And return the constructed AND clause, again being wary of a single
         * element and AND/OR flatness.
         */
-       if (length(winners) == 1)
+       if (list_length(winners) == 1)
                return (Expr *) linitial(winners);
        else
                return make_andclause(pull_ands(winners));
index 89df7bc..a6b4845 100644 (file)
@@ -15,7 +15,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/prep/preptlist.c,v 1.67 2004/05/26 04:41:26 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/prep/preptlist.c,v 1.68 2004/05/30 23:40:29 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -79,7 +79,7 @@ preprocess_targetlist(List *tlist,
                Resdom     *resdom;
                Var                *var;
 
-               resdom = makeResdom(length(tlist) + 1,
+               resdom = makeResdom(list_length(tlist) + 1,
                                                        TIDOID,
                                                        -1,
                                                        pstrdup("ctid"),
@@ -94,7 +94,7 @@ preprocess_targetlist(List *tlist,
                 * modify the original tlist (is this really necessary?).
                 */
                if (command_type == CMD_DELETE)
-                       tlist = listCopy(tlist);
+                       tlist = list_copy(tlist);
 
                tlist = lappend(tlist, makeTargetEntry(resdom, (Expr *) var));
        }
index 41809bd..af2bb7e 100644 (file)
@@ -14,7 +14,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.111 2004/05/26 04:41:26 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.112 2004/05/30 23:40:29 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -235,10 +235,10 @@ generate_union_plan(SetOperationStmt *op, Query *parse,
         * generate only one Append and Sort for the lot.  Recurse to find
         * such nodes and compute their children's plans.
         */
-       planlist = nconc(recurse_union_children(op->larg, parse,
-                                                                                       op, refnames_tlist),
-                                        recurse_union_children(op->rarg, parse,
-                                                                                       op, refnames_tlist));
+       planlist = list_concat(recurse_union_children(op->larg, parse,
+                                                                                                 op, refnames_tlist),
+                                                  recurse_union_children(op->rarg, parse,
+                                                                                                 op, refnames_tlist));
 
        /*
         * Generate tlist for Append plan node.
@@ -303,7 +303,7 @@ generate_nonunion_plan(SetOperationStmt *op, Query *parse,
                                                                   op->colTypes, false, 1,
                                                                   refnames_tlist,
                                                                   &child_sortclauses);
-       planlist = makeList2(lplan, rplan);
+       planlist = list_make2(lplan, rplan);
 
        /*
         * Generate tlist for Append plan node.
@@ -349,7 +349,7 @@ generate_nonunion_plan(SetOperationStmt *op, Query *parse,
                        cmd = SETOPCMD_INTERSECT;       /* keep compiler quiet */
                        break;
        }
-       plan = (Plan *) make_setop(cmd, plan, sortList, length(op->colTypes) + 1);
+       plan = (Plan *) make_setop(cmd, plan, sortList, list_length(op->colTypes) + 1);
 
        *sortClauses = sortList;
 
@@ -375,15 +375,15 @@ recurse_union_children(Node *setOp, Query *parse,
 
                if (op->op == top_union->op &&
                        (op->all == top_union->all || op->all) &&
-                       equalo(op->colTypes, top_union->colTypes))
+                       equal(op->colTypes, top_union->colTypes))
                {
                        /* Same UNION, so fold children into parent's subplan list */
-                       return nconc(recurse_union_children(op->larg, parse,
-                                                                                               top_union,
-                                                                                               refnames_tlist),
-                                                recurse_union_children(op->rarg, parse,
-                                                                                               top_union,
-                                                                                               refnames_tlist));
+                       return list_concat(recurse_union_children(op->larg, parse,
+                                                                                                         top_union,
+                                                                                                         refnames_tlist),
+                                                          recurse_union_children(op->rarg, parse,
+                                                                                                         top_union,
+                                                                                                         refnames_tlist));
                }
        }
 
@@ -397,10 +397,10 @@ recurse_union_children(Node *setOp, Query *parse,
         * we have an EXCEPT or INTERSECT as child, else there won't be
         * resjunk anyway.
         */
-       return makeList1(recurse_set_operations(setOp, parse,
-                                                                                       top_union->colTypes, false,
-                                                                                       -1, refnames_tlist,
-                                                                                       &child_sortclauses));
+       return list_make1(recurse_set_operations(setOp, parse,
+                                                                                        top_union->colTypes, false,
+                                                                                        -1, refnames_tlist,
+                                                                                        &child_sortclauses));
 }
 
 /*
@@ -430,7 +430,7 @@ generate_setop_tlist(List *colTypes, int flag,
        k = list_head(refnames_tlist);
        foreach(i, colTypes)
        {
-               Oid                     colType = lfirsto(i);
+               Oid                     colType = lfirst_oid(i);
                TargetEntry *inputtle = (TargetEntry *) lfirst(j);
                TargetEntry *reftle = (TargetEntry *) lfirst(k);
                int32           colTypmod;
@@ -536,7 +536,7 @@ generate_append_tlist(List *colTypes, bool flag,
         * If the inputs all agree on type and typmod of a particular column, use
         * that typmod; else use -1.  (+1 here in case of zero columns.)
         */
-       colTypmods = (int32 *) palloc(length(colTypes) * sizeof(int32) + 1);
+       colTypmods = (int32 *) palloc(list_length(colTypes) * sizeof(int32) + 1);
 
        foreach(planl, input_plans)
        {
@@ -577,7 +577,7 @@ generate_append_tlist(List *colTypes, bool flag,
        colindex = 0;
        forboth(curColType, colTypes, ref_tl_item, refnames_tlist)
        {
-               Oid                     colType = lfirsto(curColType);
+               Oid                     colType = lfirst_oid(curColType);
                int32           colTypmod = colTypmods[colindex++];
                TargetEntry *reftle = (TargetEntry *) lfirst(ref_tl_item);
 
@@ -663,7 +663,7 @@ List *
 find_all_inheritors(Oid parentrel)
 {
        List       *examined_relids = NIL;
-       List       *unexamined_relids = makeListo1(parentrel);
+       List       *unexamined_relids = list_make1_oid(parentrel);
 
        /*
         * While the queue of unexamined relids is nonempty, remove the first
@@ -676,7 +676,7 @@ find_all_inheritors(Oid parentrel)
                List       *currentchildren;
 
                unexamined_relids = list_delete_first(unexamined_relids);
-               examined_relids = lappendo(examined_relids, currentrel);
+               examined_relids = lappend_oid(examined_relids, currentrel);
                currentchildren = find_inheritance_children(currentrel);
 
                /*
@@ -686,8 +686,8 @@ find_all_inheritors(Oid parentrel)
                 * into an infinite loop, though theoretically there can't be any
                 * cycles in the inheritance graph anyway.)
                 */
-               currentchildren = set_differenceo(currentchildren, examined_relids);
-               unexamined_relids = set_uniono(unexamined_relids, currentchildren);
+               currentchildren = list_difference_oid(currentchildren, examined_relids);
+               unexamined_relids = list_union_oid(unexamined_relids, currentchildren);
        }
 
        return examined_relids;
@@ -744,17 +744,17 @@ expand_inherited_rtentry(Query *parse, Index rti, bool dup_parent)
         * case.  This could happen despite above has_subclass() check, if
         * table once had a child but no longer does.
         */
-       if (length(inhOIDs) < 2)
+       if (list_length(inhOIDs) < 2)
                return NIL;
        /* OK, it's an inheritance set; expand it */
        if (dup_parent)
                inhRTIs = NIL;
        else
-               inhRTIs = makeListi1(rti);              /* include original RTE in result */
+               inhRTIs = list_make1_int(rti);          /* include original RTE in result */
 
        foreach(l, inhOIDs)
        {
-               Oid                     childOID = lfirsto(l);
+               Oid                     childOID = lfirst_oid(l);
                RangeTblEntry *childrte;
                Index           childRTindex;
 
@@ -771,9 +771,9 @@ expand_inherited_rtentry(Query *parse, Index rti, bool dup_parent)
                childrte = copyObject(rte);
                childrte->relid = childOID;
                parse->rtable = lappend(parse->rtable, childrte);
-               childRTindex = length(parse->rtable);
+               childRTindex = list_length(parse->rtable);
 
-               inhRTIs = lappendi(inhRTIs, childRTindex);
+               inhRTIs = lappend_int(inhRTIs, childRTindex);
        }
 
        return inhRTIs;
index 0727bfb..a338960 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.171 2004/05/26 04:41:27 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.172 2004/05/30 23:40:30 neilc Exp $
  *
  * HISTORY
  *       AUTHOR                        DATE                    MAJOR EVENT
@@ -96,9 +96,9 @@ make_opclause(Oid opno, Oid opresulttype, bool opretset,
        expr->opresulttype = opresulttype;
        expr->opretset = opretset;
        if (rightop)
-               expr->args = makeList2(leftop, rightop);
+               expr->args = list_make2(leftop, rightop);
        else
-               expr->args = makeList1(leftop);
+               expr->args = list_make1(leftop);
        return (Expr *) expr;
 }
 
@@ -164,7 +164,7 @@ make_notclause(Expr *notclause)
        BoolExpr   *expr = makeNode(BoolExpr);
 
        expr->boolop = NOT_EXPR;
-       expr->args = makeList1(notclause);
+       expr->args = list_make1(notclause);
        return (Expr *) expr;
 }
 
@@ -261,7 +261,7 @@ make_and_qual(Node *qual1, Node *qual2)
                return qual2;
        if (qual2 == NULL)
                return qual1;
-       return (Node *) make_andclause(makeList2(qual1, qual2));
+       return (Node *) make_andclause(list_make2(qual1, qual2));
 }
 
 /*
@@ -278,7 +278,7 @@ make_ands_explicit(List *andclauses)
 {
        if (andclauses == NIL)
                return (Expr *) makeBoolConst(true, false);
-       else if (length(andclauses) == 1)
+       else if (list_length(andclauses) == 1)
                return (Expr *) linitial(andclauses);
        else
                return make_andclause(andclauses);
@@ -302,7 +302,7 @@ make_ands_implicit(Expr *clause)
                         DatumGetBool(((Const *) clause)->constvalue))
                return NIL;                             /* constant TRUE input -> NIL list */
        else
-               return makeList1(clause);
+               return list_make1(clause);
 }
 
 
@@ -599,7 +599,7 @@ contain_mutable_functions_walker(Node *node, void *context)
 
                foreach(opid, sublink->operOids)
                {
-                       if (op_volatile(lfirsto(opid)) != PROVOLATILE_IMMUTABLE)
+                       if (op_volatile(lfirst_oid(opid)) != PROVOLATILE_IMMUTABLE)
                                return true;
                }
                /* else fall through to check args */
@@ -682,7 +682,7 @@ contain_volatile_functions_walker(Node *node, void *context)
 
                foreach(opid, sublink->operOids)
                {
-                       if (op_volatile(lfirsto(opid)) == PROVOLATILE_VOLATILE)
+                       if (op_volatile(lfirst_oid(opid)) == PROVOLATILE_VOLATILE)
                                return true;
                }
                /* else fall through to check args */
@@ -982,7 +982,7 @@ CommuteClause(OpExpr *clause)
 
        /* Sanity checks: caller is at fault if these fail */
        if (!is_opclause(clause) ||
-               length(clause->args) != 2)
+               list_length(clause->args) != 2)
                elog(ERROR, "cannot commute non-binary-operator clause");
 
        opoid = get_commutator(clause->opno);
@@ -1281,7 +1281,7 @@ eval_const_expressions_mutator(Node *node, List *active_fns)
                                        if (newargs == NIL)
                                                return makeBoolConst(false, false);
                                        /* If only one nonconst-or-NULL input, it's the result */
-                                       if (length(newargs) == 1)
+                                       if (list_length(newargs) == 1)
                                                return (Node *) linitial(newargs);
                                        /* Else we still need an OR node */
                                        return (Node *) make_orclause(newargs);
@@ -1302,13 +1302,13 @@ eval_const_expressions_mutator(Node *node, List *active_fns)
                                        if (newargs == NIL)
                                                return makeBoolConst(true, false);
                                        /* If only one nonconst-or-NULL input, it's the result */
-                                       if (length(newargs) == 1)
+                                       if (list_length(newargs) == 1)
                                                return (Node *) linitial(newargs);
                                        /* Else we still need an AND node */
                                        return (Node *) make_andclause(newargs);
                                }
                        case NOT_EXPR:
-                               Assert(length(args) == 1);
+                               Assert(list_length(args) == 1);
                                if (IsA(linitial(args), Const))
                                {
                                        Const *const_input = (Const *) linitial(args);
@@ -1570,8 +1570,8 @@ eval_const_expressions_mutator(Node *node, List *active_fns)
                        RowExpr *rowexpr = (RowExpr *) arg;
 
                        if (fselect->fieldnum > 0 &&
-                               fselect->fieldnum <= length(rowexpr->args))
-                               return (Node *) nth(fselect->fieldnum - 1, rowexpr->args);
+                               fselect->fieldnum <= list_length(rowexpr->args))
+                               return (Node *) list_nth(rowexpr->args, fselect->fieldnum - 1);
                }
                newfselect = makeNode(FieldSelect);
                newfselect->arg = (Expr *) arg;
@@ -1640,9 +1640,9 @@ simplify_or_arguments(List *args, bool *haveNull, bool *forceTrue)
                }
                else if (or_clause(arg))
                {
-                       newargs = nconc(newargs,
-                                                       simplify_or_arguments(((BoolExpr *) arg)->args,
-                                                                                                 haveNull, forceTrue));
+                       newargs = list_concat(newargs,
+                                                                 simplify_or_arguments(((BoolExpr *) arg)->args,
+                                                                                                               haveNull, forceTrue));
                }
                else
                {
@@ -1701,9 +1701,9 @@ simplify_and_arguments(List *args, bool *haveNull, bool *forceFalse)
                }
                else if (and_clause(arg))
                {
-                       newargs = nconc(newargs,
-                                                       simplify_and_arguments(((BoolExpr *) arg)->args,
-                                                                                                  haveNull, forceFalse));
+                       newargs = list_concat(newargs,
+                                                                 simplify_and_arguments(((BoolExpr *) arg)->args,
+                                                                                                                haveNull, forceFalse));
                }
                else
                {
@@ -1880,11 +1880,11 @@ inline_function(Oid funcid, Oid result_type, List *args,
        if (funcform->prolang != SQLlanguageId ||
                funcform->prosecdef ||
                funcform->proretset ||
-               funcform->pronargs != length(args))
+               funcform->pronargs != list_length(args))
                return NULL;
 
        /* Check for recursive function, and give up trying to expand if so */
-       if (oidMember(funcid, active_fns))
+       if (list_member_oid(active_fns, funcid))
                return NULL;
 
        /* Check permission to call function (fail later, if not) */
@@ -1899,7 +1899,7 @@ inline_function(Oid funcid, Oid result_type, List *args,
                        argtypes[i] == ANYELEMENTOID)
                {
                        polymorphic = true;
-                       argtypes[i] = exprType((Node *) nth(i, args));
+                       argtypes[i] = exprType((Node *) list_nth(args, i));
                }
        }
 
@@ -1943,13 +1943,13 @@ inline_function(Oid funcid, Oid result_type, List *args,
         * more than one command in the function body.
         */
        raw_parsetree_list = pg_parse_query(src);
-       if (length(raw_parsetree_list) != 1)
+       if (list_length(raw_parsetree_list) != 1)
                goto fail;
 
        querytree_list = parse_analyze(linitial(raw_parsetree_list),
                                                                   argtypes, funcform->pronargs);
 
-       if (length(querytree_list) != 1)
+       if (list_length(querytree_list) != 1)
                goto fail;
 
        querytree = (Query *) linitial(querytree_list);
@@ -1973,7 +1973,7 @@ inline_function(Oid funcid, Oid result_type, List *args,
                querytree->limitOffset ||
                querytree->limitCount ||
                querytree->setOperations ||
-               length(querytree->targetList) != 1)
+               list_length(querytree->targetList) != 1)
                goto fail;
 
        newexpr = (Node *) ((TargetEntry *) linitial(querytree->targetList))->expr;
@@ -2048,7 +2048,7 @@ inline_function(Oid funcid, Oid result_type, List *args,
                         */
                        if (contain_subplans(param))
                                goto fail;
-                       cost_qual_eval(&eval_cost, makeList1(param));
+                       cost_qual_eval(&eval_cost, list_make1(param));
                        if (eval_cost.startup + eval_cost.per_tuple >
                                10 * cpu_operator_cost)
                                goto fail;
@@ -2078,7 +2078,7 @@ inline_function(Oid funcid, Oid result_type, List *args,
         * add the current function to the context list of active functions.
         */
        newexpr = eval_const_expressions_mutator(newexpr,
-                                                                                        lconso(funcid, active_fns));
+                                                                                        lcons_oid(funcid, active_fns));
 
        error_context_stack = sqlerrcontext.previous;
 
@@ -2129,7 +2129,7 @@ substitute_actual_parameters_mutator(Node *node,
 
                /* Select the appropriate actual arg and replace the Param with it */
                /* We don't need to copy at this time (it'll get done later) */
-               return nth(param->paramid - 1, context->args);
+               return list_nth(context->args, param->paramid - 1);
        }
        return expression_tree_mutator(node, substitute_actual_parameters_mutator,
                                                                   (void *) context);
index 7c08275..d2ce08b 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/util/joininfo.c,v 1.38 2004/05/26 04:41:27 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/util/joininfo.c,v 1.39 2004/05/30 23:40:31 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -162,9 +162,9 @@ remove_join_clause_from_rels(Query *root,
                 * Remove the restrictinfo from the list.  Pointer comparison is
                 * sufficient.
                 */
-               Assert(ptrMember(restrictinfo, joininfo->jinfo_restrictinfo));
-               joininfo->jinfo_restrictinfo = lremove(restrictinfo,
-                                                                                  joininfo->jinfo_restrictinfo);
+               Assert(list_member_ptr(joininfo->jinfo_restrictinfo, restrictinfo));
+               joininfo->jinfo_restrictinfo = list_delete_ptr(joininfo->jinfo_restrictinfo,
+                                                                                                          restrictinfo);
                bms_free(unjoined_relids);
        }
        bms_free(tmprelids);
index 3bad7a4..91be3e2 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.105 2004/05/26 04:41:27 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.106 2004/05/30 23:40:31 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -452,9 +452,9 @@ create_index_path(Query *root,
         * 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(restriction_clauses);
-       pathnode->indexquals = makeList1(indexquals);
+       pathnode->indexinfo = list_make1(index);
+       pathnode->indexclauses = list_make1(restriction_clauses);
+       pathnode->indexquals = list_make1(indexquals);
 
        /* It's not an innerjoin path. */
        pathnode->isjoininner = false;
@@ -686,12 +686,12 @@ create_unique_path(Query *root, RelOptInfo *rel, Path *subpath)
        if (sub_targetlist)
        {
                pathnode->rows = estimate_num_groups(root, sub_targetlist, rel->rows);
-               numCols = length(sub_targetlist);
+               numCols = list_length(sub_targetlist);
        }
        else
        {
                pathnode->rows = rel->rows;
-               numCols = length(FastListValue(&rel->reltargetlist));
+               numCols = list_length(FastListValue(&rel->reltargetlist));
        }
 
        /*
index 55b9a12..e7ff6bf 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.92 2004/05/26 04:41:27 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.93 2004/05/30 23:40:31 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -82,7 +82,7 @@ get_relation_info(Oid relationObjectId, RelOptInfo *rel)
 
                foreach(l, indexoidlist)
                {
-                       Oid                     indexoid = lfirsto(l);
+                       Oid                     indexoid = lfirst_oid(l);
                        Relation        indexRelation;
                        Form_pg_index index;
                        IndexOptInfo *info;
@@ -158,7 +158,7 @@ get_relation_info(Oid relationObjectId, RelOptInfo *rel)
                        indexinfos = lcons(info, indexinfos);
                }
 
-               freeList(indexoidlist);
+               list_free(indexoidlist);
        }
 
        rel->indexlist = indexinfos;
@@ -338,7 +338,7 @@ find_inheritance_children(Oid inhparent)
        while ((inheritsTuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
        {
                inhrelid = ((Form_pg_inherits) GETSTRUCT(inheritsTuple))->inhrelid;
-               list = lappendo(list, inhrelid);
+               list = lappend_oid(list, inhrelid);
        }
        heap_endscan(scan);
        heap_close(relation, AccessShareLock);
index 8969b2d..ba1e7e6 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.57 2004/05/26 04:41:27 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.58 2004/05/30 23:40:31 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -162,7 +162,7 @@ make_base_rel(Query *root, int relid)
                        /* Subquery or function --- need only set up attr range */
                        /* Note: 0 is included in range to support whole-row Vars */
                        rel->min_attr = 0;
-                       rel->max_attr = length(rte->eref->colnames);
+                       rel->max_attr = list_length(rte->eref->colnames);
                        break;
                default:
                        elog(ERROR, "unrecognized RTE kind: %d",
@@ -446,10 +446,10 @@ build_joinrel_restrictlist(Query *root,
        /*
         * Collect all the clauses that syntactically belong at this level.
         */
-       rlist = nconc(subbuild_joinrel_restrictlist(joinrel,
-                                                                                               outer_rel->joininfo),
-                                 subbuild_joinrel_restrictlist(joinrel,
-                                                                                               inner_rel->joininfo));
+       rlist = list_concat(subbuild_joinrel_restrictlist(joinrel,
+                                                                                                         outer_rel->joininfo),
+                                               subbuild_joinrel_restrictlist(joinrel,
+                                                                                                         inner_rel->joininfo));
 
        /*
         * Eliminate duplicate and redundant clauses.
@@ -462,7 +462,7 @@ build_joinrel_restrictlist(Query *root,
         */
        result = remove_redundant_join_clauses(root, rlist, jointype);
 
-       freeList(rlist);
+       list_free(rlist);
 
        return result;
 }
@@ -496,8 +496,8 @@ subbuild_joinrel_restrictlist(RelOptInfo *joinrel,
                         * We must copy the list to avoid disturbing the input relation,
                         * but we can use a shallow copy.
                         */
-                       restrictlist = nconc(restrictlist,
-                                                                listCopy(joininfo->jinfo_restrictinfo));
+                       restrictlist = list_concat(restrictlist,
+                                                                          list_copy(joininfo->jinfo_restrictinfo));
                }
                else
                {
@@ -549,8 +549,8 @@ subbuild_joinrel_joinlist(RelOptInfo *joinrel,
 
                        new_joininfo = make_joininfo_node(joinrel, new_unjoined_relids);
                        new_joininfo->jinfo_restrictinfo =
-                               set_ptrUnion(new_joininfo->jinfo_restrictinfo,
-                                                        joininfo->jinfo_restrictinfo);
+                               list_union_ptr(new_joininfo->jinfo_restrictinfo,
+                                                          joininfo->jinfo_restrictinfo);
                }
        }
 }
index 1cb446e..9786adb 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/util/restrictinfo.c,v 1.27 2004/05/26 04:41:27 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/util/restrictinfo.c,v 1.28 2004/05/30 23:40:31 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -99,7 +99,7 @@ make_restrictinfo_from_indexclauses(List *indexclauses,
        if (indexclauses == NIL)
                return NIL;
        /* If single indexscan, just return the ANDed clauses */
-       if (length(indexclauses) == 1)
+       if (list_length(indexclauses) == 1)
                return (List *) linitial(indexclauses);
        /* Else we need an OR RestrictInfo structure */
        foreach(orlist, indexclauses)
@@ -112,7 +112,7 @@ make_restrictinfo_from_indexclauses(List *indexclauses,
                andlist = get_actual_clauses(andlist);
                withoutris = lappend(withoutris, make_ands_explicit(andlist));
        }
-       return makeList1(make_restrictinfo_internal(make_orclause(withoutris),
+       return list_make1(make_restrictinfo_internal(make_orclause(withoutris),
                                                                                                make_orclause(withris),
                                                                                                is_pushed_down,
                                                                                                valid_everywhere));
@@ -139,7 +139,7 @@ make_restrictinfo_internal(Expr *clause, Expr *orclause,
         * If it's a binary opclause, set up left/right relids info.
         * In any case set up the total clause relids info.
         */
-       if (is_opclause(clause) && length(((OpExpr *) clause)->args) == 2)
+       if (is_opclause(clause) && list_length(((OpExpr *) clause)->args) == 2)
        {
                restrictinfo->left_relids = pull_varnos(get_leftop(clause));
                restrictinfo->right_relids = pull_varnos(get_rightop(clause));
@@ -350,7 +350,7 @@ remove_redundant_join_clauses(Query *root, List *restrictinfo_list,
                else if (CLAUSECOST(rinfo) < CLAUSECOST(prevrinfo))
                {
                        /* keep this one, drop the previous one */
-                       result = lremove(prevrinfo, result);
+                       result = list_delete_ptr(result, prevrinfo);
                        result = lappend(result, rinfo);
                }
                /* else, drop this one */
index cd8ced1..dcee4f8 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/util/tlist.c,v 1.63 2004/05/26 04:41:27 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/util/tlist.c,v 1.64 2004/05/30 23:40:31 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -121,7 +121,7 @@ flatten_tlist(List *tlist)
        List       *new_tlist;
 
        new_tlist = add_to_flat_tlist(NIL, vlist);
-       freeList(vlist);
+       list_free(vlist);
        return new_tlist;
 }
 
@@ -137,7 +137,7 @@ flatten_tlist(List *tlist)
 List *
 add_to_flat_tlist(List *tlist, List *vars)
 {
-       int                     next_resdomno = length(tlist) + 1;
+       int                     next_resdomno = list_length(tlist) + 1;
        ListCell   *v;
 
        foreach(v, vars)
index ecdc93a..cae304f 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/util/var.c,v 1.57 2004/05/26 04:41:27 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/util/var.c,v 1.58 2004/05/30 23:40:31 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -543,7 +543,7 @@ flatten_join_alias_vars_mutator(Node *node,
 
                /* Expand join alias reference */
                Assert(var->varattno > 0);
-               newvar = (Node *) nth(var->varattno - 1, rte->joinaliasvars);
+               newvar = (Node *) list_nth(rte->joinaliasvars, var->varattno - 1);
 
                /*
                 * If we are expanding an alias carried down from an upper query,
index 9da8937..525c2ee 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *     $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.301 2004/05/26 04:41:29 neilc Exp $
+ *     $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.302 2004/05/30 23:40:32 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -248,12 +248,12 @@ do_parse_analyze(Node *parseTree, ParseState *pstate)
        release_pstate_resources(pstate);
 
        foreach(l, extras_before)
-               result = nconc(result, parse_sub_analyze(lfirst(l), pstate));
+               result = list_concat(result, parse_sub_analyze(lfirst(l), pstate));
 
        result = lappend(result, query);
 
        foreach(l, extras_after)
-               result = nconc(result, parse_sub_analyze(lfirst(l), pstate));
+               result = list_concat(result, parse_sub_analyze(lfirst(l), pstate));
 
        /*
         * Make sure that only the original query is marked original. We have
@@ -592,7 +592,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt,
                                                                                        true);
                rtr = makeNode(RangeTblRef);
                /* assume new rte is at end */
-               rtr->rtindex = length(pstate->p_rtable);
+               rtr->rtindex = list_length(pstate->p_rtable);
                Assert(rte == rt_fetch(rtr->rtindex, pstate->p_rtable));
                pstate->p_joinlist = lappend(pstate->p_joinlist, rtr);
 
@@ -674,7 +674,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt,
                Assert(IsA(col, ResTarget));
 
                Assert(!tle->resdom->resjunk);
-               updateTargetListEntry(pstate, tle, col->name, lfirsti(attnos),
+               updateTargetListEntry(pstate, tle, col->name, lfirst_int(attnos),
                                                          col->indirection);
 
                icols = lnext(icols);
@@ -874,8 +874,8 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt,
        q->utilityStmt = (Node *) stmt;
        stmt->tableElts = cxt.columns;
        stmt->constraints = cxt.ckconstraints;
-       *extras_before = nconc(*extras_before, cxt.blist);
-       *extras_after = nconc(cxt.alist, *extras_after);
+       *extras_before = list_concat(*extras_before, cxt.blist);
+       *extras_after = list_concat(cxt.alist, *extras_after);
 
        return q;
 }
@@ -893,7 +893,7 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
 
        /* Check for SERIAL pseudo-types */
        is_serial = false;
-       if (length(column->typename->names) == 1)
+       if (list_length(column->typename->names) == 1)
        {
                char       *typname = strVal(linitial(column->typename->names));
 
@@ -969,7 +969,7 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
                snamenode->val.val.str = qstring;
                funccallnode = makeNode(FuncCall);
                funccallnode->funcname = SystemFuncName("nextval");
-               funccallnode->args = makeList1(snamenode);
+               funccallnode->args = list_make1(snamenode);
                funccallnode->agg_star = false;
                funccallnode->agg_distinct = false;
 
@@ -1004,7 +1004,7 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
                {
                        FkConstraint *fkconstraint = (FkConstraint *) constraint;
 
-                       fkconstraint->fk_attrs = makeList1(makeString(column->colname));
+                       fkconstraint->fk_attrs = list_make1(makeString(column->colname));
                        cxt->fkconstraints = lappend(cxt->fkconstraints, fkconstraint);
                        continue;
                }
@@ -1049,7 +1049,7 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
                                                                                                          NULL,
                                                                                                          "pkey");
                                if (constraint->keys == NIL)
-                                       constraint->keys = makeList1(makeString(column->colname));
+                                       constraint->keys = list_make1(makeString(column->colname));
                                cxt->ixconstraints = lappend(cxt->ixconstraints, constraint);
                                break;
 
@@ -1059,7 +1059,7 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
                                                                                                          column->colname,
                                                                                                          "key");
                                if (constraint->keys == NIL)
-                                       constraint->keys = makeList1(makeString(column->colname));
+                                       constraint->keys = list_make1(makeString(column->colname));
                                cxt->ixconstraints = lappend(cxt->ixconstraints, constraint);
                                break;
 
@@ -1437,7 +1437,7 @@ transformIndexConstraints(ParseState *pstate, CreateStmtContext *cxt)
        if (cxt->pkey != NULL)
        {
                /* Make sure we keep the PKEY index in preference to others... */
-               cxt->alist = makeList1(cxt->pkey);
+               cxt->alist = list_make1(cxt->pkey);
        }
 
        foreach(l, indexlist)
@@ -1679,7 +1679,7 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt,
        stmt->whereClause = transformWhereClause(pstate, stmt->whereClause,
                                                                                         "WHERE");
 
-       if (length(pstate->p_rtable) != 2)      /* naughty, naughty... */
+       if (list_length(pstate->p_rtable) != 2) /* naughty, naughty... */
                ereport(ERROR,
                                (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
                                 errmsg("rule WHERE condition may not contain references to other relations")));
@@ -1708,7 +1708,7 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt,
                nothing_qry->rtable = pstate->p_rtable;
                nothing_qry->jointree = makeFromExpr(NIL, NULL);                /* no join wanted */
 
-               stmt->actions = makeList1(nothing_qry);
+               stmt->actions = list_make1(nothing_qry);
        }
        else
        {
@@ -2062,7 +2062,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
 
        foreach(dtlist, sostmt->colTypes)
        {
-               Oid                     colType = lfirsto(dtlist);
+               Oid                     colType = lfirst_oid(dtlist);
                Resdom     *leftResdom;
                char       *colName;
                Resdom     *resdom;
@@ -2123,10 +2123,10 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
        jrtr->rtindex = 1;                      /* only entry in dummy rtable */
 
        sv_rtable = pstate->p_rtable;
-       pstate->p_rtable = makeList1(jrte);
+       pstate->p_rtable = list_make1(jrte);
 
        sv_namespace = pstate->p_namespace;
-       pstate->p_namespace = makeList1(jrtr);
+       pstate->p_namespace = list_make1(jrtr);
 
        /*
         * For now, we don't support resjunk sort clauses on the output of a
@@ -2134,7 +2134,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
         * selecting an output column by name or number.  Enforce by checking
         * that transformSortClause doesn't add any items to tlist.
         */
-       tllen = length(qry->targetList);
+       tllen = list_length(qry->targetList);
 
        qry->sortClause = transformSortClause(pstate,
                                                                                  sortClause,
@@ -2144,7 +2144,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
        pstate->p_namespace = sv_namespace;
        pstate->p_rtable = sv_rtable;
 
-       if (tllen != length(qry->targetList))
+       if (tllen != list_length(qry->targetList))
                ereport(ERROR,
                                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                                 errmsg("ORDER BY on a UNION/INTERSECT/EXCEPT result must be on one of the result columns")));
@@ -2231,7 +2231,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt)
                 */
                selectList = parse_sub_analyze((Node *) stmt, pstate);
 
-               Assert(length(selectList) == 1);
+               Assert(list_length(selectList) == 1);
                selectQuery = (Query *) linitial(selectList);
                Assert(IsA(selectQuery, Query));
 
@@ -2253,7 +2253,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt)
                 * Make the leaf query be a subquery in the top-level rangetable.
                 */
                snprintf(selectName, sizeof(selectName), "*SELECT* %d",
-                                length(pstate->p_rtable) + 1);
+                                list_length(pstate->p_rtable) + 1);
                rte = addRangeTableEntryForSubquery(pstate,
                                                                                        selectQuery,
                                                                                        makeAlias(selectName, NIL),
@@ -2265,7 +2265,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt)
                 */
                rtr = makeNode(RangeTblRef);
                /* assume new rte is at end */
-               rtr->rtindex = length(pstate->p_rtable);
+               rtr->rtindex = list_length(pstate->p_rtable);
                Assert(rte == rt_fetch(rtr->rtindex, pstate->p_rtable));
                return (Node *) rtr;
        }
@@ -2298,7 +2298,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt)
                 */
                lcoltypes = getSetColTypes(pstate, op->larg);
                rcoltypes = getSetColTypes(pstate, op->rarg);
-               if (length(lcoltypes) != length(rcoltypes))
+               if (list_length(lcoltypes) != list_length(rcoltypes))
                        ereport(ERROR,
                                        (errcode(ERRCODE_SYNTAX_ERROR),
                         errmsg("each %s query must have the same number of columns",
@@ -2307,13 +2307,13 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt)
                op->colTypes = NIL;
                forboth(l, lcoltypes, r, rcoltypes)
                {
-                       Oid                     lcoltype = lfirsto(l);
-                       Oid                     rcoltype = lfirsto(r);
+                       Oid                     lcoltype = lfirst_oid(l);
+                       Oid                     rcoltype = lfirst_oid(r);
                        Oid                     rescoltype;
 
-                       rescoltype = select_common_type(makeListo2(lcoltype, rcoltype),
+                       rescoltype = select_common_type(list_make2_oid(lcoltype, rcoltype),
                                                                                        context);
-                       op->colTypes = lappendo(op->colTypes, rescoltype);
+                       op->colTypes = lappend_oid(op->colTypes, rescoltype);
                }
 
                return (Node *) op;
@@ -2344,7 +2344,7 @@ getSetColTypes(ParseState *pstate, Node *node)
 
                        if (resnode->resjunk)
                                continue;
-                       result = lappendo(result, resnode->restype);
+                       result = lappend_oid(result, resnode->restype);
                }
                return result;
        }
@@ -2370,7 +2370,7 @@ applyColumnNames(List *dst, List *src)
        ListCell *dst_item = list_head(dst);
        ListCell *src_item = list_head(src);
 
-       if (length(src) > length(dst))
+       if (list_length(src) > list_length(dst))
                ereport(ERROR,
                                (errcode(ERRCODE_SYNTAX_ERROR),
                         errmsg("CREATE TABLE AS specifies too many column names")));
@@ -2632,8 +2632,8 @@ transformAlterTableStmt(ParseState *pstate, AlterTableStmt *stmt,
        qry->commandType = CMD_UTILITY;
        qry->utilityStmt = (Node *) stmt;
 
-       *extras_before = nconc(*extras_before, cxt.blist);
-       *extras_after = nconc(cxt.alist, *extras_after);
+       *extras_before = list_concat(*extras_before, cxt.blist);
+       *extras_after = list_concat(cxt.alist, *extras_after);
 
        return qry;
 }
@@ -2681,7 +2681,7 @@ transformPrepareStmt(ParseState *pstate, PrepareStmt *stmt)
        result->utilityStmt = (Node *) stmt;
 
        /* Transform list of TypeNames to list (and array) of type OIDs */
-       nargs = length(stmt->argtypes);
+       nargs = list_length(stmt->argtypes);
 
        if (nargs)
        {
@@ -2695,7 +2695,7 @@ transformPrepareStmt(ParseState *pstate, PrepareStmt *stmt)
                        TypeName   *tn = lfirst(l);
                        Oid                     toid = typenameTypeId(tn);
 
-                       argtype_oids = lappendo(argtype_oids, toid);
+                       argtype_oids = lappend_oid(argtype_oids, toid);
                        argtoids[i++] = toid;
                }
        }
@@ -2712,7 +2712,7 @@ transformPrepareStmt(ParseState *pstate, PrepareStmt *stmt)
         * Shouldn't get any extra statements, since grammar only allows
         * OptimizableStmt
         */
-       if (length(queries) != 1)
+       if (list_length(queries) != 1)
                elog(ERROR, "unexpected extra stuff in prepared statement");
 
        stmt->query = linitial(queries);
@@ -2733,8 +2733,8 @@ transformExecuteStmt(ParseState *pstate, ExecuteStmt *stmt)
 
        if (stmt->params || paramtypes)
        {
-               int                     nparams = length(stmt->params);
-               int                     nexpected = length(paramtypes);
+               int                     nparams = list_length(stmt->params);
+               int                     nexpected = list_length(paramtypes);
                ListCell   *l, *l2;
                int                     i = 1;
 
@@ -2749,7 +2749,7 @@ transformExecuteStmt(ParseState *pstate, ExecuteStmt *stmt)
                forboth(l, stmt->params, l2, paramtypes)
                {
                        Node       *expr = lfirst(l);
-                       Oid                     expected_type_id = lfirsto(l2);
+                       Oid                     expected_type_id = lfirst_oid(l2);
                        Oid                     given_type_id;
 
                        expr = transformExpr(pstate, expr);
@@ -2838,8 +2838,8 @@ transformForUpdate(Query *qry, List *forUpdate)
                        switch (rte->rtekind)
                        {
                                case RTE_RELATION:
-                                       if (!intMember(i, rowMarks))    /* avoid duplicates */
-                                               rowMarks = lappendi(rowMarks, i);
+                                       if (!list_member_int(rowMarks, i))      /* avoid duplicates */
+                                               rowMarks = lappend_int(rowMarks, i);
                                        rte->requiredPerms |= ACL_SELECT_FOR_UPDATE;
                                        break;
                                case RTE_SUBQUERY:
@@ -2847,7 +2847,7 @@ transformForUpdate(Query *qry, List *forUpdate)
                                         * FOR UPDATE of subquery is propagated to subquery's
                                         * rels
                                         */
-                                       transformForUpdate(rte->subquery, makeList1(NULL));
+                                       transformForUpdate(rte->subquery, list_make1(NULL));
                                        break;
                                default:
                                        /* ignore JOIN, SPECIAL, FUNCTION RTEs */
@@ -2873,8 +2873,8 @@ transformForUpdate(Query *qry, List *forUpdate)
                                        switch (rte->rtekind)
                                        {
                                                case RTE_RELATION:
-                                                       if (!intMember(i, rowMarks)) /* avoid duplicates */
-                                                               rowMarks = lappendi(rowMarks, i);
+                                                       if (!list_member_int(rowMarks, i)) /* avoid duplicates */
+                                                               rowMarks = lappend_int(rowMarks, i);
                                                        rte->requiredPerms |= ACL_SELECT_FOR_UPDATE;
                                                        break;
                                                case RTE_SUBQUERY:
@@ -2882,7 +2882,7 @@ transformForUpdate(Query *qry, List *forUpdate)
                                                         * FOR UPDATE of subquery is propagated to
                                                         * subquery's rels
                                                         */
-                                                       transformForUpdate(rte->subquery, makeList1(NULL));
+                                                       transformForUpdate(rte->subquery, list_make1(NULL));
                                                        break;
                                                case RTE_JOIN:
                                                        ereport(ERROR,
@@ -3198,12 +3198,12 @@ analyzeCreateSchemaStmt(CreateSchemaStmt *stmt)
        }
 
        result = NIL;
-       result = nconc(result, cxt.sequences);
-       result = nconc(result, cxt.tables);
-       result = nconc(result, cxt.views);
-       result = nconc(result, cxt.indexes);
-       result = nconc(result, cxt.triggers);
-       result = nconc(result, cxt.grants);
+       result = list_concat(result, cxt.sequences);
+       result = list_concat(result, cxt.tables);
+       result = list_concat(result, cxt.views);
+       result = list_concat(result, cxt.indexes);
+       result = list_concat(result, cxt.triggers);
+       result = list_concat(result, cxt.grants);
 
        return result;
 }
index 4600a29..db783ae 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.457 2004/05/26 15:07:37 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.458 2004/05/30 23:40:34 neilc Exp $
  *
  * HISTORY
  *       AUTHOR                        DATE                    MAJOR EVENT
@@ -480,7 +480,7 @@ stmtmulti:  stmtmulti ';' stmt
                                }
                        | stmt
                                        { if ($1 != NULL)
-                                               $$ = makeList1($1);
+                                               $$ = list_make1($1);
                                          else
                                                $$ = NIL;
                                        }
@@ -693,7 +693,7 @@ OptUserElem:
                ;
 
 user_list:     user_list ',' UserId            { $$ = lappend($1, makeString($3)); }
-                       | UserId                                        { $$ = makeList1(makeString($1)); }
+                       | UserId                                        { $$ = list_make1(makeString($1)); }
                ;
 
 
@@ -878,7 +878,7 @@ set_rest:  var_name TO var_list_or_default
                                        VariableSetStmt *n = makeNode(VariableSetStmt);
                                        n->name = "timezone";
                                        if ($3 != NULL)
-                                               n->args = makeList1($3);
+                                               n->args = list_make1($3);
                                        $$ = n;
                                }
                        | TRANSACTION transaction_mode_list
@@ -900,14 +900,14 @@ set_rest:  var_name TO var_list_or_default
                                        VariableSetStmt *n = makeNode(VariableSetStmt);
                                        n->name = "client_encoding";
                                        if ($2 != NULL)
-                                               n->args = makeList1(makeStringConst($2, NULL));
+                                               n->args = list_make1(makeStringConst($2, NULL));
                                        $$ = n;
                                }
                        | SESSION AUTHORIZATION ColId_or_Sconst
                                {
                                        VariableSetStmt *n = makeNode(VariableSetStmt);
                                        n->name = "session_authorization";
-                                       n->args = makeList1(makeStringConst($3, NULL));
+                                       n->args = list_make1(makeStringConst($3, NULL));
                                        $$ = n;
                                }
                        | SESSION AUTHORIZATION DEFAULT
@@ -937,7 +937,7 @@ var_list_or_default:
                        | DEFAULT                                                               { $$ = NIL; }
                ;
 
-var_list:      var_value                                                               { $$ = makeList1($1); }
+var_list:      var_value                                                               { $$ = list_make1($1); }
                        | var_list ',' var_value                                { $$ = lappend($1, $3); }
                ;
 
@@ -1153,7 +1153,7 @@ AlterTableStmt:
                ;
 
 alter_table_cmds:
-                       alter_table_cmd                                                 { $$ = makeList1($1); }
+                       alter_table_cmd                                                 { $$ = list_make1($1); }
                        | alter_table_cmds ',' alter_table_cmd  { $$ = lappend($1, $3); }
                ;
 
@@ -1348,7 +1348,7 @@ CopyStmt: COPY opt_binary qualified_name opt_column_list opt_oids
                                        if ($8)
                                                n->options = lappend(n->options, $8);
                                        if ($10)
-                                               n->options = nconc(n->options, $10);
+                                               n->options = list_concat(n->options, $10);
                                        $$ = (Node *)n;
                                }
                ;
@@ -1479,7 +1479,7 @@ CreateStmt:       CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')'
                                        $4->istemp = $2;
                                        n->relation = $4;
                                        n->tableElts = $8;
-                                       n->inhRelations = makeList1($6);
+                                       n->inhRelations = list_make1($6);
                                        n->constraints = NIL;
                                        n->hasoids = $10;
                                        n->oncommit = $11;
@@ -1511,7 +1511,7 @@ OptTableElementList:
 TableElementList:
                        TableElement
                                {
-                                       $$ = makeList1($1);
+                                       $$ = list_make1($1);
                                }
                        | TableElementList ',' TableElement
                                {
@@ -1814,7 +1814,7 @@ opt_column_list:
                ;
 
 columnList:
-                       columnElem                                                              { $$ = makeList1($1); }
+                       columnElem                                                              { $$ = list_make1($1); }
                        | columnList ',' columnElem                             { $$ = lappend($1, $3); }
                ;
 
@@ -1941,7 +1941,7 @@ OptCreateAs:
                ;
 
 CreateAsList:
-                       CreateAsElement                                                 { $$ = makeList1($1); }
+                       CreateAsElement                                                 { $$ = list_make1($1); }
                        | CreateAsList ',' CreateAsElement              { $$ = lappend($1, $3); }
                ;
 
@@ -2099,7 +2099,7 @@ opt_trusted:
  */
 handler_name:
                        name
-                                                       { $$ = makeList1(makeString($1)); }
+                                                       { $$ = list_make1(makeString($1)); }
                        | dotted_name                                                   { $$ = $1; }
                ;
 
@@ -2236,7 +2236,7 @@ TriggerForType:
                ;
 
 TriggerFuncArgs:
-                       TriggerFuncArg                                                  { $$ = makeList1($1); }
+                       TriggerFuncArg                                                  { $$ = list_make1($1); }
                        | TriggerFuncArgs ',' TriggerFuncArg    { $$ = lappend($1, $3); }
                        | /*EMPTY*/                                                             { $$ = NIL; }
                ;
@@ -2328,7 +2328,7 @@ CreateAssertStmt:
                                {
                                        CreateTrigStmt *n = makeNode(CreateTrigStmt);
                                        n->trigname = $3;
-                                       n->args = makeList1($6);
+                                       n->args = list_make1($6);
                                        n->isconstraint  = TRUE;
                                        n->deferrable = ($8 & 1) != 0;
                                        n->initdeferred = ($8 & 2) != 0;
@@ -2395,7 +2395,7 @@ DefineStmt:
                                        RangeVar *r = makeNode(RangeVar);
 
                                        /* can't use qualified_name, sigh */
-                                       switch (length($3))
+                                       switch (list_length($3))
                                        {
                                                case 1:
                                                        r->catalogname = NULL;
@@ -2428,7 +2428,7 @@ DefineStmt:
 definition: '(' def_list ')'                                           { $$ = $2; }
                ;
 
-def_list:      def_elem                                                                { $$ = makeList1($1); }
+def_list:      def_elem                                                                { $$ = list_make1($1); }
                        | def_list ',' def_elem                                 { $$ = lappend($1, $3); }
                ;
 
@@ -2473,7 +2473,7 @@ CreateOpClassStmt:
                ;
 
 opclass_item_list:
-                       opclass_item                                                    { $$ = makeList1($1); }
+                       opclass_item                                                    { $$ = list_make1($1); }
                        | opclass_item_list ',' opclass_item    { $$ = lappend($1, $3); }
                ;
 
@@ -2566,11 +2566,11 @@ drop_type:      TABLE                                                                   { $$ = OBJECT_TABLE; }
                ;
 
 any_name_list:
-                       any_name                                                                { $$ = makeList1($1); }
+                       any_name                                                                { $$ = list_make1($1); }
                        | any_name_list ',' any_name                    { $$ = lappend($1, $3); }
                ;
 
-any_name:      ColId                                           { $$ = makeList1(makeString($1)); }
+any_name:      ColId                                           { $$ = list_make1(makeString($1)); }
                        | dotted_name                           { $$ = $1; }
                ;
 
@@ -2623,7 +2623,7 @@ CommentStmt:
                                        CommentStmt *n = makeNode(CommentStmt);
                                        n->objtype = OBJECT_AGGREGATE;
                                        n->objname = $4;
-                                       n->objargs = makeList1($6);
+                                       n->objargs = list_make1($6);
                                        n->comment = $9;
                                        $$ = (Node *) n;
                                }
@@ -2669,7 +2669,7 @@ CommentStmt:
                                        /* Obsolete syntax supported for awhile for compatibility */
                                        CommentStmt *n = makeNode(CommentStmt);
                                        n->objtype = OBJECT_RULE;
-                                       n->objname = makeList1(makeString($4));
+                                       n->objname = list_make1(makeString($4));
                                        n->objargs = NIL;
                                        n->comment = $6;
                                        $$ = (Node *) n;
@@ -2688,7 +2688,7 @@ CommentStmt:
                                        CommentStmt *n = makeNode(CommentStmt);
                                        n->objtype = OBJECT_OPCLASS;
                                        n->objname = $5;
-                                       n->objargs = makeList1(makeString($7));
+                                       n->objargs = list_make1(makeString($7));
                                        n->comment = $9;
                                        $$ = (Node *) n;
                                }
@@ -2696,7 +2696,7 @@ CommentStmt:
                                {
                                        CommentStmt *n = makeNode(CommentStmt);
                                        n->objtype = OBJECT_LARGEOBJECT;
-                                       n->objname = makeList1($5);
+                                       n->objname = list_make1($5);
                                        n->objargs = NIL;
                                        n->comment = $7;
                                        $$ = (Node *) n;
@@ -2705,8 +2705,8 @@ CommentStmt:
                                {
                                        CommentStmt *n = makeNode(CommentStmt);
                                        n->objtype = OBJECT_CAST;
-                                       n->objname = makeList1($5);
-                                       n->objargs = makeList1($7);
+                                       n->objname = list_make1($5);
+                                       n->objargs = list_make1($7);
                                        n->comment = $10;
                                        $$ = (Node *) n;
                                }
@@ -2937,13 +2937,13 @@ RevokeStmt: REVOKE opt_revoke_grant_option privileges ON privilege_target
 
 /* either ALL [PRIVILEGES] or a list of individual privileges */
 privileges: privilege_list                             { $$ = $1; }
-                       | ALL                                           { $$ = makeListi1(ACL_ALL_RIGHTS); }
-                       | ALL PRIVILEGES                        { $$ = makeListi1(ACL_ALL_RIGHTS); }
+                       | ALL                                           { $$ = list_make1_int(ACL_ALL_RIGHTS); }
+                       | ALL PRIVILEGES                        { $$ = list_make1_int(ACL_ALL_RIGHTS); }
                ;
 
 privilege_list:
-                       privilege                                                               { $$ = makeListi1($1); }
-                       | privilege_list ',' privilege                  { $$ = lappendi($1, $3); }
+                       privilege                                                               { $$ = list_make1_int($1); }
+                       | privilege_list ',' privilege                  { $$ = lappend_int($1, $3); }
                ;
 
 /* Not all of these privilege types apply to all objects, but that
@@ -3013,7 +3013,7 @@ privilege_target:
 
 
 grantee_list:
-                       grantee                                                                 { $$ = makeList1($1); }
+                       grantee                                                                 { $$ = list_make1($1); }
                        | grantee_list ',' grantee                              { $$ = lappend($1, $3); }
                ;
 
@@ -3054,7 +3054,7 @@ opt_revoke_grant_option:
 
 
 function_with_argtypes_list:
-                       function_with_argtypes                                  { $$ = makeList1($1); }
+                       function_with_argtypes                                  { $$ = list_make1($1); }
                        | function_with_argtypes_list ',' function_with_argtypes
                                                                                                        { $$ = lappend($1, $3); }
                ;
@@ -3103,7 +3103,7 @@ access_method_clause:
                        | /*EMPTY*/                                                             { $$ = DEFAULT_INDEX_TYPE; }
                ;
 
-index_params:  index_elem                                                      { $$ = makeList1($1); }
+index_params:  index_elem                                                      { $$ = list_make1($1); }
                        | index_params ',' index_elem                   { $$ = lappend($1, $3); }
                ;
 
@@ -3182,7 +3182,7 @@ func_args:        '(' func_args_list ')'                                  { $$ = $2; }
                ;
 
 func_args_list:
-                       func_arg                                                                { $$ = makeList1($1); }
+                       func_arg                                                                { $$ = list_make1($1); }
                        | func_args_list ',' func_arg                   { $$ = lappend($1, $3); }
                ;
 
@@ -3259,7 +3259,7 @@ func_type:        Typename                                                                { $$ = $1; }
 
 createfunc_opt_list:
                        /* Must be at least one to prevent conflict */
-                       createfunc_opt_item                     { $$ = makeList1($1); }
+                       createfunc_opt_item                     { $$ = list_make1($1); }
                        | createfunc_opt_list createfunc_opt_item { $$ = lappend($1, $2); }
        ;
 
@@ -3314,10 +3314,10 @@ createfunc_opt_item:
                                }
                ;
 
-func_as:       Sconst                                          { $$ = makeList1(makeString($1)); }
+func_as:       Sconst                                          { $$ = list_make1(makeString($1)); }
                        | Sconst ',' Sconst
                                {
-                                       $$ = makeList2(makeString($1), makeString($3));
+                                       $$ = list_make2(makeString($1), makeString($3));
                                }
                ;
 
@@ -3384,16 +3384,16 @@ oper_argtypes:
                                                        errhint("Use NONE to denote the missing argument of a unary operator.")));
                                }
                        | Typename ',' Typename
-                                       { $$ = makeList2($1, $3); }
+                                       { $$ = list_make2($1, $3); }
                        | NONE ',' Typename /* left unary */
-                                       { $$ = makeList2(NULL, $3); }
+                                       { $$ = list_make2(NULL, $3); }
                        | Typename ',' NONE /* right unary */
-                                       { $$ = makeList2($1, NULL); }
+                                       { $$ = list_make2($1, NULL); }
                ;
 
 any_operator:
                        all_Op
-                                       { $$ = makeList1(makeString($1)); }
+                                       { $$ = list_make1(makeString($1)); }
                        | ColId '.' any_operator
                                        { $$ = lcons(makeString($1), $3); }
                ;
@@ -3495,7 +3495,7 @@ RenameStmt: ALTER AGGREGATE func_name '(' aggr_argtype ')' RENAME TO name
                                        RenameStmt *n = makeNode(RenameStmt);
                                        n->renameType = OBJECT_AGGREGATE;
                                        n->object = $3;
-                                       n->objarg = makeList1($5);
+                                       n->objarg = list_make1($5);
                                        n->newname = $9;
                                        $$ = (Node *)n;
                                }
@@ -3625,7 +3625,7 @@ RuleStmt: CREATE opt_or_replace RULE name AS
 
 RuleActionList:
                        NOTHING                                                                 { $$ = NIL; }
-                       | RuleActionStmt                                                { $$ = makeList1($1); }
+                       | RuleActionStmt                                                { $$ = list_make1($1); }
                        | '(' RuleActionMulti ')'                               { $$ = $2; }
                ;
 
@@ -3639,7 +3639,7 @@ RuleActionMulti:
                                }
                        | RuleActionStmtOrEmpty
                                { if ($1 != NULL)
-                                       $$ = makeList1($1);
+                                       $$ = list_make1($1);
                                  else
                                        $$ = NIL;
                                }
@@ -3788,24 +3788,24 @@ opt_transaction:        WORK                                                    {}
 
 transaction_mode_list:
                        ISOLATION LEVEL iso_level
-                                       { $$ = makeList1(makeDefElem("transaction_isolation",
-                                                                                                makeStringConst($3, NULL))); }
+                                       { $$ = list_make1(makeDefElem("transaction_isolation",
+                                                                                                 makeStringConst($3, NULL))); }
                        | transaction_access_mode
-                                       { $$ = makeList1(makeDefElem("transaction_read_only",
-                                                                                                makeIntConst($1))); }
+                                       { $$ = list_make1(makeDefElem("transaction_read_only",
+                                                                                                 makeIntConst($1))); }
                        | ISOLATION LEVEL iso_level transaction_access_mode
                                        {
-                                               $$ = makeList2(makeDefElem("transaction_isolation",
-                                                                                                  makeStringConst($3, NULL)),
-                                                                          makeDefElem("transaction_read_only",
-                                                                                                  makeIntConst($4)));
+                                               $$ = list_make2(makeDefElem("transaction_isolation",
+                                                                                                       makeStringConst($3, NULL)),
+                                                                               makeDefElem("transaction_read_only",
+                                                                                                       makeIntConst($4)));
                                        }
                        | transaction_access_mode ISOLATION LEVEL iso_level
                                        {
-                                               $$ = makeList2(makeDefElem("transaction_read_only",
-                                                                                                  makeIntConst($1)),
-                                                                          makeDefElem("transaction_isolation",
-                                                                                                  makeStringConst($4, NULL)));
+                                               $$ = list_make2(makeDefElem("transaction_read_only",
+                                                                                                       makeIntConst($1)),
+                                                                               makeDefElem("transaction_isolation",
+                                                                                                       makeStringConst($4, NULL)));
                                        }
                ;
 
@@ -4258,7 +4258,7 @@ prep_type_clause: '(' prep_type_list ')'  { $$ = $2; }
                                | /* EMPTY */                           { $$ = NIL; }
                ;
 
-prep_type_list: Typename                       { $$ = makeList1($1); }
+prep_type_list: Typename                       { $$ = list_make1($1); }
                          | prep_type_list ',' Typename
                                                                        { $$ = lappend($1, $3); }
                ;
@@ -4380,7 +4380,7 @@ insert_rest:
                ;
 
 insert_column_list:
-                       insert_column_item                                              { $$ = makeList1($1); }
+                       insert_column_item                                              { $$ = list_make1($1); }
                        | insert_column_list ',' insert_column_item
                                        { $$ = lappend($1, $3); }
                ;
@@ -4566,13 +4566,13 @@ select_no_parens:
                        | select_clause opt_sort_clause for_update_clause opt_select_limit
                                {
                                        insertSelectOptions((SelectStmt *) $1, $2, $3,
-                                                                               nth(0, $4), nth(1, $4));
+                                                                               list_nth($4, 0), list_nth($4, 1));
                                        $$ = $1;
                                }
                        | select_clause opt_sort_clause select_limit opt_for_update_clause
                                {
                                        insertSelectOptions((SelectStmt *) $1, $2, $4,
-                                                                               nth(0, $3), nth(1, $3));
+                                                                               list_nth($3, 0), list_nth($3, 1));
                                        $$ = $1;
                                }
                ;
@@ -4701,7 +4701,7 @@ opt_all:  ALL                                                                             { $$ = TRUE; }
  * should be placed in the DISTINCT list during parsetree analysis.
  */
 opt_distinct:
-                       DISTINCT                                                                { $$ = makeList1(NIL); }
+                       DISTINCT                                                                { $$ = list_make1(NIL); }
                        | DISTINCT ON '(' expr_list ')'                 { $$ = $4; }
                        | ALL                                                                   { $$ = NIL; }
                        | /*EMPTY*/                                                             { $$ = NIL; }
@@ -4717,7 +4717,7 @@ sort_clause:
                ;
 
 sortby_list:
-                       sortby                                                                  { $$ = makeList1($1); }
+                       sortby                                                                  { $$ = list_make1($1); }
                        | sortby_list ',' sortby                                { $$ = lappend($1, $3); }
                ;
 
@@ -4754,13 +4754,13 @@ sortby:         a_expr USING qual_all_Op
 
 select_limit:
                        LIMIT select_limit_value OFFSET select_offset_value
-                               { $$ = makeList2($4, $2); }
+                               { $$ = list_make2($4, $2); }
                        | OFFSET select_offset_value LIMIT select_limit_value
-                               { $$ = makeList2($2, $4); }
+                               { $$ = list_make2($2, $4); }
                        | LIMIT select_limit_value
-                               { $$ = makeList2(NULL, $2); }
+                               { $$ = list_make2(NULL, $2); }
                        | OFFSET select_offset_value
-                               { $$ = makeList2($2, NULL); }
+                               { $$ = list_make2($2, NULL); }
                        | LIMIT select_limit_value ',' select_offset_value
                                {
                                        /* Disabled because it was too confusing, bjm 2002-02-18 */
@@ -4774,7 +4774,7 @@ select_limit:
 opt_select_limit:
                        select_limit                                                    { $$ = $1; }
                        | /* EMPTY */
-                                       { $$ = makeList2(NULL,NULL); }
+                                       { $$ = list_make2(NULL,NULL); }
                ;
 
 select_limit_value:
@@ -4822,7 +4822,7 @@ opt_for_update_clause:
 
 update_list:
                        OF name_list                                                    { $$ = $2; }
-                       | /* EMPTY */                                                   { $$ = makeList1(NULL); }
+                       | /* EMPTY */                                                   { $$ = list_make1(NULL); }
                ;
 
 /*****************************************************************************
@@ -4839,7 +4839,7 @@ from_clause:
                ;
 
 from_list:
-                       table_ref                                                               { $$ = makeList1($1); }
+                       table_ref                                                               { $$ = list_make1($1); }
                        | from_list ',' table_ref                               { $$ = lappend($1, $3); }
                ;
 
@@ -5151,7 +5151,7 @@ where_clause:
 TableFuncElementList:
                        TableFuncElement
                                {
-                                       $$ = makeList1($1);
+                                       $$ = list_make1($1);
                                }
                        | TableFuncElementList ',' TableFuncElement
                                {
@@ -5195,13 +5195,13 @@ Typename:       SimpleTypename opt_array_bounds
                                {
                                        /* SQL99's redundant syntax */
                                        $$ = $1;
-                                       $$->arrayBounds = makeList1(makeInteger($4));
+                                       $$->arrayBounds = list_make1(makeInteger($4));
                                }
                        | SETOF SimpleTypename ARRAY '[' Iconst ']'
                                {
                                        /* SQL99's redundant syntax */
                                        $$ = $2;
-                                       $$->arrayBounds = makeList1(makeInteger($5));
+                                       $$->arrayBounds = list_make1(makeInteger($5));
                                        $$->setof = TRUE;
                                }
                ;
@@ -5755,7 +5755,7 @@ a_expr:           c_expr                                                                  { $$ = $1; }
                                {
                                        FuncCall *n = makeNode(FuncCall);
                                        n->funcname = SystemFuncName("timezone");
-                                       n->args = makeList2($5, $1);
+                                       n->args = list_make2($5, $1);
                                        n->agg_star = FALSE;
                                        n->agg_distinct = FALSE;
                                        $$ = (Node *) n;
@@ -5820,7 +5820,7 @@ a_expr:           c_expr                                                                  { $$ = $1; }
                                {
                                        FuncCall *n = makeNode(FuncCall);
                                        n->funcname = SystemFuncName("like_escape");
-                                       n->args = makeList2($3, $5);
+                                       n->args = list_make2($3, $5);
                                        n->agg_star = FALSE;
                                        n->agg_distinct = FALSE;
                                        $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~~", $1, (Node *) n);
@@ -5831,7 +5831,7 @@ a_expr:           c_expr                                                                  { $$ = $1; }
                                {
                                        FuncCall *n = makeNode(FuncCall);
                                        n->funcname = SystemFuncName("like_escape");
-                                       n->args = makeList2($4, $6);
+                                       n->args = list_make2($4, $6);
                                        n->agg_star = FALSE;
                                        n->agg_distinct = FALSE;
                                        $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~~", $1, (Node *) n);
@@ -5842,7 +5842,7 @@ a_expr:           c_expr                                                                  { $$ = $1; }
                                {
                                        FuncCall *n = makeNode(FuncCall);
                                        n->funcname = SystemFuncName("like_escape");
-                                       n->args = makeList2($3, $5);
+                                       n->args = list_make2($3, $5);
                                        n->agg_star = FALSE;
                                        n->agg_distinct = FALSE;
                                        $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~~*", $1, (Node *) n);
@@ -5853,7 +5853,7 @@ a_expr:           c_expr                                                                  { $$ = $1; }
                                {
                                        FuncCall *n = makeNode(FuncCall);
                                        n->funcname = SystemFuncName("like_escape");
-                                       n->args = makeList2($4, $6);
+                                       n->args = list_make2($4, $6);
                                        n->agg_star = FALSE;
                                        n->agg_distinct = FALSE;
                                        $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~~*", $1, (Node *) n);
@@ -5865,7 +5865,7 @@ a_expr:           c_expr                                                                  { $$ = $1; }
                                        FuncCall *n = makeNode(FuncCall);
                                        c->val.type = T_Null;
                                        n->funcname = SystemFuncName("similar_escape");
-                                       n->args = makeList2($4, (Node *) c);
+                                       n->args = list_make2($4, (Node *) c);
                                        n->agg_star = FALSE;
                                        n->agg_distinct = FALSE;
                                        $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~", $1, (Node *) n);
@@ -5874,7 +5874,7 @@ a_expr:           c_expr                                                                  { $$ = $1; }
                                {
                                        FuncCall *n = makeNode(FuncCall);
                                        n->funcname = SystemFuncName("similar_escape");
-                                       n->args = makeList2($4, $6);
+                                       n->args = list_make2($4, $6);
                                        n->agg_star = FALSE;
                                        n->agg_distinct = FALSE;
                                        $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~", $1, (Node *) n);
@@ -5885,7 +5885,7 @@ a_expr:           c_expr                                                                  { $$ = $1; }
                                        FuncCall *n = makeNode(FuncCall);
                                        c->val.type = T_Null;
                                        n->funcname = SystemFuncName("similar_escape");
-                                       n->args = makeList2($5, (Node *) c);
+                                       n->args = list_make2($5, (Node *) c);
                                        n->agg_star = FALSE;
                                        n->agg_distinct = FALSE;
                                        $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~", $1, (Node *) n);
@@ -5894,7 +5894,7 @@ a_expr:           c_expr                                                                  { $$ = $1; }
                                {
                                        FuncCall *n = makeNode(FuncCall);
                                        n->funcname = SystemFuncName("similar_escape");
-                                       n->args = makeList2($5, $7);
+                                       n->args = list_make2($5, $7);
                                        n->agg_star = FALSE;
                                        n->agg_distinct = FALSE;
                                        $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~", $1, (Node *) n);
@@ -6037,8 +6037,8 @@ a_expr:           c_expr                                                                  { $$ = $1; }
                                                        if (IsA($1, RowExpr))
                                                                n->lefthand = ((RowExpr *) $1)->args;
                                                        else
-                                                               n->lefthand = makeList1($1);
-                                                       n->operName = makeList1(makeString("="));
+                                                               n->lefthand = list_make1($1);
+                                                       n->operName = list_make1(makeString("="));
                                                        $$ = (Node *)n;
                                        }
                                        else
@@ -6068,8 +6068,8 @@ a_expr:           c_expr                                                                  { $$ = $1; }
                                                if (IsA($1, RowExpr))
                                                        n->lefthand = ((RowExpr *) $1)->args;
                                                else
-                                                       n->lefthand = makeList1($1);
-                                               n->operName = makeList1(makeString("="));
+                                                       n->lefthand = list_make1($1);
+                                               n->operName = list_make1(makeString("="));
                                                /* Stick a NOT on top */
                                                $$ = (Node *) makeA_Expr(AEXPR_NOT, NIL, NULL, (Node *) n);
                                        }
@@ -6096,7 +6096,7 @@ a_expr:           c_expr                                                                  { $$ = $1; }
                                        if (IsA($1, RowExpr))
                                                n->lefthand = ((RowExpr *) $1)->args;
                                        else
-                                               n->lefthand = makeList1($1);
+                                               n->lefthand = list_make1($1);
                                        n->operName = $2;
                                        n->subselect = $4;
                                        $$ = (Node *)n;
@@ -6293,7 +6293,7 @@ c_expr:           columnref                                                               { $$ = (Node *) $1; }
                                        star->val.type = T_Integer;
                                        star->val.val.ival = 1;
                                        n->funcname = $1;
-                                       n->args = makeList1(star);
+                                       n->args = list_make1(star);
                                        n->agg_star = TRUE;
                                        n->agg_distinct = FALSE;
                                        $$ = (Node *)n;
@@ -6625,7 +6625,7 @@ c_expr:           columnref                                                               { $$ = (Node *) $1; }
                                         * at the moment they result in the same thing.
                                         */
                                        n->funcname = SystemFuncName(((Value *)llast($5->names))->val.str);
-                                       n->args = makeList1($3);
+                                       n->args = list_make1($3);
                                        $$ = (Node *)n;
                                }
                        | TRIM '(' BOTH trim_list ')'
@@ -6676,7 +6676,7 @@ c_expr:           columnref                                                               { $$ = (Node *) $1; }
                                        c->val.val.str = NameListToQuotedString($5);
 
                                        n->funcname = SystemFuncName("convert_using");
-                                       n->args = makeList2($3, c);
+                                       n->args = list_make2($3, c);
                                        n->agg_star = FALSE;
                                        n->agg_distinct = FALSE;
                                        $$ = (Node *)n;
@@ -6764,31 +6764,31 @@ MathOp:          '+'                                                                    { $$ = "+"; }
                ;
 
 qual_Op:       Op
-                                       { $$ = makeList1(makeString($1)); }
+                                       { $$ = list_make1(makeString($1)); }
                        | OPERATOR '(' any_operator ')'
                                        { $$ = $3; }
                ;
 
 qual_all_Op:
                        all_Op
-                                       { $$ = makeList1(makeString($1)); }
+                                       { $$ = list_make1(makeString($1)); }
                        | OPERATOR '(' any_operator ')'
                                        { $$ = $3; }
                ;
 
 subquery_Op:
                        all_Op
-                                       { $$ = makeList1(makeString($1)); }
+                                       { $$ = list_make1(makeString($1)); }
                        | OPERATOR '(' any_operator ')'
                                        { $$ = $3; }
                        | LIKE
-                                       { $$ = makeList1(makeString("~~")); }
+                                       { $$ = list_make1(makeString("~~")); }
                        | NOT LIKE
-                                       { $$ = makeList1(makeString("!~~")); }
+                                       { $$ = list_make1(makeString("!~~")); }
                        | ILIKE
-                                       { $$ = makeList1(makeString("~~*")); }
+                                       { $$ = list_make1(makeString("~~*")); }
                        | NOT ILIKE
-                                       { $$ = makeList1(makeString("!~~*")); }
+                                       { $$ = list_make1(makeString("!~~*")); }
 /* cannot put SIMILAR TO here, because SIMILAR TO is a hack.
  * the regular expression is preprocessed by a function (similar_escape),
  * and the ~ operator for posix regular expressions is used. 
@@ -6838,7 +6838,7 @@ extract_list:
                                        A_Const *n = makeNode(A_Const);
                                        n->val.type = T_String;
                                        n->val.val.str = $1;
-                                       $$ = makeList2((Node *) n, $3);
+                                       $$ = list_make2((Node *) n, $3);
                                }
                        | /*EMPTY*/                                                             { $$ = NIL; }
                ;
@@ -6849,12 +6849,12 @@ type_list:  type_list ',' Typename
                                }
                        | Typename
                                {
-                                       $$ = makeList1($1);
+                                       $$ = list_make1($1);
                                }
                ;
 
 array_expr_list: array_expr
-                               {       $$ = makeList1($1);             }
+                               {       $$ = list_make1($1);            }
                        | array_expr_list ',' array_expr
                                {       $$ = lappend($1, $3);   }
                ;
@@ -6896,11 +6896,11 @@ extract_arg:
 overlay_list:
                        a_expr overlay_placing substr_from substr_for
                                {
-                                       $$ = makeList4($1, $2, $3, $4);
+                                       $$ = list_make4($1, $2, $3, $4);
                                }
                        | a_expr overlay_placing substr_from
                                {
-                                       $$ = makeList3($1, $2, $3);
+                                       $$ = list_make3($1, $2, $3);
                                }
                ;
 
@@ -6912,7 +6912,7 @@ overlay_placing:
 /* position_list uses b_expr not a_expr to avoid conflict with general IN */
 
 position_list:
-                       b_expr IN_P b_expr                                              { $$ = makeList2($3, $1); }
+                       b_expr IN_P b_expr                                              { $$ = list_make2($3, $1); }
                        | /*EMPTY*/                                                             { $$ = NIL; }
                ;
 
@@ -6930,22 +6930,22 @@ position_list:
 substr_list:
                        a_expr substr_from substr_for
                                {
-                                       $$ = makeList3($1, $2, $3);
+                                       $$ = list_make3($1, $2, $3);
                                }
                        | a_expr substr_for substr_from
                                {
-                                       $$ = makeList3($1, $3, $2);
+                                       $$ = list_make3($1, $3, $2);
                                }
                        | a_expr substr_from
                                {
-                                       $$ = makeList2($1, $2);
+                                       $$ = list_make2($1, $2);
                                }
                        | a_expr substr_for
                                {
                                        A_Const *n = makeNode(A_Const);
                                        n->val.type = T_Integer;
                                        n->val.val.ival = 1;
-                                       $$ = makeList3($1, (Node *)n, $2);
+                                       $$ = list_make3($1, (Node *)n, $2);
                                }
                        | expr_list
                                {
@@ -7019,7 +7019,7 @@ case_expr:        CASE case_arg when_clause_list case_default END_P
 
 when_clause_list:
                        /* There must be at least one */
-                       when_clause                                                             { $$ = makeList1($1); }
+                       when_clause                                                             { $$ = list_make1($1); }
                        | when_clause_list when_clause                  { $$ = lappend($1, $2); }
                ;
 
@@ -7050,7 +7050,7 @@ case_arg: a_expr                                                                  { $$ = $1; }
 columnref:     relation_name opt_indirection
                                {
                                        $$ = makeNode(ColumnRef);
-                                       $$->fields = makeList1(makeString($1));
+                                       $$->fields = list_make1(makeString($1));
                                        $$->indirection = $2;
                                }
                        | dotted_name opt_indirection
@@ -7067,9 +7067,9 @@ dotted_name:
                ;
 
 attrs:         '.' attr_name
-                                       { $$ = makeList1(makeString($2)); }
+                                       { $$ = list_make1(makeString($2)); }
                        | '.' '*'
-                                       { $$ = makeList1(makeString("*")); }
+                                       { $$ = list_make1(makeString("*")); }
                        | '.' attr_name attrs
                                        { $$ = lcons(makeString($2), $3); }
                ;
@@ -7084,7 +7084,7 @@ attrs:            '.' attr_name
 /* Target lists as found in SELECT ... and INSERT VALUES ( ... ) */
 
 target_list:
-                       target_el                                                               { $$ = makeList1($1); }
+                       target_el                                                               { $$ = list_make1($1); }
                        | target_list ',' target_el                             { $$ = lappend($1, $3); }
                ;
 
@@ -7106,7 +7106,7 @@ target_el:        a_expr AS ColLabel
                        | '*'
                                {
                                        ColumnRef *n = makeNode(ColumnRef);
-                                       n->fields = makeList1(makeString("*"));
+                                       n->fields = list_make1(makeString("*"));
                                        n->indirection = NIL;
                                        $$ = makeNode(ResTarget);
                                        $$->name = NULL;
@@ -7122,7 +7122,7 @@ target_el:        a_expr AS ColLabel
 }
  */
 update_target_list:
-                       update_target_el                                                { $$ = makeList1($1); }
+                       update_target_el                                                { $$ = list_make1($1); }
                        | update_target_list ',' update_target_el { $$ = lappend($1,$3); }
                ;
 
@@ -7145,7 +7145,7 @@ update_target_el:
                ;
 
 insert_target_list:
-                       insert_target_el                                                { $$ = makeList1($1); }
+                       insert_target_el                                                { $$ = list_make1($1); }
                        | insert_target_list ',' insert_target_el { $$ = lappend($1, $3); }
                ;
 
@@ -7173,7 +7173,7 @@ relation_name:
                ;
 
 qualified_name_list:
-                       qualified_name                                                  { $$ = makeList1($1); }
+                       qualified_name                                                  { $$ = list_make1($1); }
                        | qualified_name_list ',' qualified_name { $$ = lappend($1, $3); }
                ;
 
@@ -7188,7 +7188,7 @@ qualified_name:
                        | dotted_name
                                {
                                        $$ = makeNode(RangeVar);
-                                       switch (length($1))
+                                       switch (list_length($1))
                                        {
                                                case 2:
                                                        $$->catalogname = NULL;
@@ -7211,7 +7211,7 @@ qualified_name:
                ;
 
 name_list:     name
-                                       { $$ = makeList1(makeString($1)); }
+                                       { $$ = list_make1(makeString($1)); }
                        | name_list ',' name
                                        { $$ = lappend($1, makeString($3)); }
                ;
@@ -7232,7 +7232,7 @@ index_name: ColId                                                                 { $$ = $1; };
 file_name:     Sconst                                                                  { $$ = $1; };
 
 func_name:     function_name
-                                       { $$ = makeList1(makeString($1)); }
+                                       { $$ = list_make1(makeString($1)); }
                        | dotted_name                                                   { $$ = $1; }
                ;
 
@@ -7924,19 +7924,19 @@ makeOverlaps(List *largs, List *rargs)
 {
        FuncCall *n = makeNode(FuncCall);
        n->funcname = SystemFuncName("overlaps");
-       if (length(largs) == 1)
+       if (list_length(largs) == 1)
                largs = lappend(largs, largs);
-       else if (length(largs) != 2)
+       else if (list_length(largs) != 2)
                ereport(ERROR,
                                (errcode(ERRCODE_SYNTAX_ERROR),
                                 errmsg("wrong number of parameters on left side of OVERLAPS expression")));
-       if (length(rargs) == 1)
+       if (list_length(rargs) == 1)
                rargs = lappend(rargs, rargs);
-       else if (length(rargs) != 2)
+       else if (list_length(rargs) != 2)
                ereport(ERROR,
                                (errcode(ERRCODE_SYNTAX_ERROR),
                                 errmsg("wrong number of parameters on right side of OVERLAPS expression")));
-       n->args = nconc(largs, rargs);
+       n->args = list_concat(largs, rargs);
        n->agg_star = FALSE;
        n->agg_distinct = FALSE;
        return n;
@@ -8041,7 +8041,7 @@ makeSetOp(SetOperation op, bool all, Node *larg, Node *rarg)
 List *
 SystemFuncName(char *name)
 {
-       return makeList2(makeString("pg_catalog"), makeString(name));
+       return list_make2(makeString("pg_catalog"), makeString(name));
 }
 
 /* SystemTypeName()
@@ -8054,7 +8054,7 @@ SystemTypeName(char *name)
 {
        TypeName   *n = makeNode(TypeName);
 
-       n->names = makeList2(makeString("pg_catalog"), makeString(name));
+       n->names = list_make2(makeString("pg_catalog"), makeString(name));
        n->typmod = -1;
        return n;
 }
index e9c73ee..16e571e 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/parser/parse_agg.c,v 1.62 2004/05/26 04:41:29 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/parser/parse_agg.c,v 1.63 2004/05/30 23:40:34 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -307,7 +307,7 @@ check_ungrouped_columns_walker(Node *node,
 
                /* Found an ungrouped local variable; generate error message */
                Assert(var->varno > 0 &&
-                          (int) var->varno <= length(context->pstate->p_rtable));
+                          (int) var->varno <= list_length(context->pstate->p_rtable));
                rte = rt_fetch(var->varno, context->pstate->p_rtable);
                attname = get_rte_attribute_name(rte, var->varattno);
                if (context->sublevels_up == 0)
@@ -394,10 +394,10 @@ build_aggregate_fnexprs(Oid agg_input_type,
                arg1->paramid = -1;
                arg1->paramtype = agg_input_type;
 
-               args = makeList2(arg0, arg1);
+               args = list_make2(arg0, arg1);
        }
        else
-               args = makeList1(arg0);
+               args = list_make1(arg0);
 
        *transfnexpr = (Expr *) makeFuncExpr(transfn_oid,
                                                                                 agg_state_type,
@@ -418,7 +418,7 @@ build_aggregate_fnexprs(Oid agg_input_type,
        arg0->paramkind = PARAM_EXEC;
        arg0->paramid = -1;
        arg0->paramtype = agg_state_type;
-       args = makeList1(arg0);
+       args = list_make1(arg0);
 
        *finalfnexpr = (Expr *) makeFuncExpr(finalfn_oid,
                                                                                 agg_result_type,
index 610c4fa..a090166 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.130 2004/05/26 04:41:29 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.131 2004/05/30 23:40:34 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -148,7 +148,7 @@ setTargetTable(ParseState *pstate, RangeVar *relation,
        pstate->p_target_rangetblentry = rte;
 
        /* assume new rte is at end */
-       rtindex = length(pstate->p_rtable);
+       rtindex = list_length(pstate->p_rtable);
        Assert(rte == rt_fetch(rtindex, pstate->p_rtable));
 
        /*
@@ -233,7 +233,7 @@ extractRemainingColumns(List *common_colnames,
        List       *new_colvars = NIL;
        ListCell   *lnames, *lvars;
 
-       Assert(length(src_colnames) == length(src_colvars));
+       Assert(list_length(src_colnames) == list_length(src_colvars));
 
        forboth(lnames, src_colnames, lvars, src_colvars)
        {
@@ -336,7 +336,7 @@ transformJoinOnClause(ParseState *pstate, JoinExpr *j,
         * to be added.
         */
        save_namespace = pstate->p_namespace;
-       pstate->p_namespace = makeList2(j->larg, j->rarg);
+       pstate->p_namespace = list_make2(j->larg, j->rarg);
 
        result = transformWhereClause(pstate, j->quals, "JOIN/ON");
 
@@ -353,7 +353,7 @@ transformJoinOnClause(ParseState *pstate, JoinExpr *j,
        clause_varnos = pull_varnos(result);
        while ((varno = bms_first_member(clause_varnos)) >= 0)
        {
-               if (!intMember(varno, containedRels))
+               if (!list_member_int(containedRels, varno))
                {
                        ereport(ERROR,
                                        (errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
@@ -391,7 +391,7 @@ transformTableEntry(ParseState *pstate, RangeVar *r)
         */
        rtr = makeNode(RangeTblRef);
        /* assume new rte is at end */
-       rtr->rtindex = length(pstate->p_rtable);
+       rtr->rtindex = list_length(pstate->p_rtable);
        Assert(rte == rt_fetch(rtr->rtindex, pstate->p_rtable));
 
        return rtr;
@@ -429,7 +429,7 @@ transformRangeSubselect(ParseState *pstate, RangeSubselect *r)
         * are probably impossible given restrictions of the grammar, but
         * check 'em anyway.
         */
-       if (length(parsetrees) != 1)
+       if (list_length(parsetrees) != 1)
                elog(ERROR, "unexpected parse analysis result for subquery in FROM");
        query = (Query *) linitial(parsetrees);
        if (query == NULL || !IsA(query, Query))
@@ -476,7 +476,7 @@ transformRangeSubselect(ParseState *pstate, RangeSubselect *r)
         */
        rtr = makeNode(RangeTblRef);
        /* assume new rte is at end */
-       rtr->rtindex = length(pstate->p_rtable);
+       rtr->rtindex = list_length(pstate->p_rtable);
        Assert(rte == rt_fetch(rtr->rtindex, pstate->p_rtable));
 
        return rtr;
@@ -556,7 +556,7 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r)
         */
        rtr = makeNode(RangeTblRef);
        /* assume new rte is at end */
-       rtr->rtindex = length(pstate->p_rtable);
+       rtr->rtindex = list_length(pstate->p_rtable);
        Assert(rte == rt_fetch(rtr->rtindex, pstate->p_rtable));
 
        return rtr;
@@ -584,7 +584,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
                RangeTblRef *rtr;
 
                rtr = transformTableEntry(pstate, (RangeVar *) n);
-               *containedRels = makeListi1(rtr->rtindex);
+               *containedRels = list_make1_int(rtr->rtindex);
                return (Node *) rtr;
        }
        else if (IsA(n, RangeSubselect))
@@ -593,7 +593,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
                RangeTblRef *rtr;
 
                rtr = transformRangeSubselect(pstate, (RangeSubselect *) n);
-               *containedRels = makeListi1(rtr->rtindex);
+               *containedRels = list_make1_int(rtr->rtindex);
                return (Node *) rtr;
        }
        else if (IsA(n, RangeFunction))
@@ -602,7 +602,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
                RangeTblRef *rtr;
 
                rtr = transformRangeFunction(pstate, (RangeFunction *) n);
-               *containedRels = makeListi1(rtr->rtindex);
+               *containedRels = list_make1_int(rtr->rtindex);
                return (Node *) rtr;
        }
        else if (IsA(n, JoinExpr))
@@ -632,7 +632,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
                 * Generate combined list of relation indexes for possible use by
                 * transformJoinOnClause below.
                 */
-               my_containedRels = nconc(l_containedRels, r_containedRels);
+               my_containedRels = list_concat(l_containedRels, r_containedRels);
 
                /*
                 * Check for conflicting refnames in left and right subtrees. Must
@@ -799,9 +799,9 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
                                                         errmsg("column \"%s\" specified in USING clause does not exist in right table",
                                                                        u_colname)));
 
-                               l_colvar = nth(l_index, l_colvars);
+                               l_colvar = list_nth(l_colvars, l_index);
                                l_usingvars = lappend(l_usingvars, l_colvar);
-                               r_colvar = nth(r_index, r_colvars);
+                               r_colvar = list_nth(r_colvars, r_index);
                                r_usingvars = lappend(r_usingvars, r_colvar);
 
                                res_colnames = lappend(res_colnames, lfirst(ucol));
@@ -833,10 +833,10 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
                extractRemainingColumns(res_colnames,
                                                                r_colnames, r_colvars,
                                                                &r_colnames, &r_colvars);
-               res_colnames = nconc(res_colnames, l_colnames);
-               res_colvars = nconc(res_colvars, l_colvars);
-               res_colnames = nconc(res_colnames, r_colnames);
-               res_colvars = nconc(res_colvars, r_colvars);
+               res_colnames = list_concat(res_colnames, l_colnames);
+               res_colvars = list_concat(res_colvars, l_colvars);
+               res_colnames = list_concat(res_colnames, r_colnames);
+               res_colvars = list_concat(res_colvars, r_colvars);
 
                /*
                 * Check alias (AS clause), if any.
@@ -845,7 +845,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
                {
                        if (j->alias->colnames != NIL)
                        {
-                               if (length(j->alias->colnames) > length(res_colnames))
+                               if (list_length(j->alias->colnames) > list_length(res_colnames))
                                        ereport(ERROR,
                                                        (errcode(ERRCODE_SYNTAX_ERROR),
                                                         errmsg("column alias list for \"%s\" has too many entries",
@@ -864,13 +864,13 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
                                                                                true);
 
                /* assume new rte is at end */
-               j->rtindex = length(pstate->p_rtable);
+               j->rtindex = list_length(pstate->p_rtable);
                Assert(rte == rt_fetch(j->rtindex, pstate->p_rtable));
 
                /*
                 * Include join RTE in returned containedRels list
                 */
-               *containedRels = lconsi(j->rtindex, my_containedRels);
+               *containedRels = lcons_int(j->rtindex, my_containedRels);
 
                return (Node *) j;
        }
@@ -900,8 +900,8 @@ buildMergedJoinVar(ParseState *pstate, JoinType jointype,
        outcoltypmod = l_colvar->vartypmod;
        if (outcoltype != r_colvar->vartype)
        {
-               outcoltype = select_common_type(makeListo2(l_colvar->vartype,
-                                                                                                  r_colvar->vartype),
+               outcoltype = select_common_type(list_make2_oid(l_colvar->vartype,
+                                                                                                          r_colvar->vartype),
                                                                                "JOIN/USING");
                outcoltypmod = -1;              /* ie, unknown */
        }
@@ -973,7 +973,7 @@ buildMergedJoinVar(ParseState *pstate, JoinType jointype,
                                CoalesceExpr *c = makeNode(CoalesceExpr);
 
                                c->coalescetype = outcoltype;
-                               c->args = makeList2(l_node, r_node);
+                               c->args = list_make2(l_node, r_node);
                                res_node = (Node *) c;
                                break;
                        }
@@ -1122,7 +1122,7 @@ findTargetlistEntry(ParseState *pstate, Node *node, List **tlist, int clause)
         *----------
         */
        if (IsA(node, ColumnRef) &&
-               length(((ColumnRef *) node)->fields) == 1 &&
+               list_length(((ColumnRef *) node)->fields) == 1 &&
                ((ColumnRef *) node)->indirection == NIL)
        {
                char       *name = strVal(linitial(((ColumnRef *) node)->fields));
index ba32109..9ba0bdc 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.116 2004/05/26 04:41:30 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.117 2004/05/30 23:40:35 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -245,7 +245,7 @@ coerce_type(ParseState *pstate, Node *node,
                        Oid                     baseTypeId = getBaseType(targetTypeId);
 
                        result = (Node *) makeFuncExpr(funcId, baseTypeId,
-                                                                                  makeList1(node),
+                                                                                  list_make1(node),
                                                                                   cformat);
 
                        /*
@@ -508,7 +508,7 @@ coerce_type_typmod(Node *node, Oid targetTypeId, int32 targetTypMod,
                                                 false,
                                                 true);
 
-               args = makeList2(node, cons);
+               args = list_make2(node, cons);
 
                if (nargs == 3)
                {
@@ -562,7 +562,7 @@ coerce_record_to_complex(ParseState *pstate, Node *node,
                rte = GetRTEByRangeTablePosn(pstate,
                                                                         ((Var *) node)->varno,
                                                                         ((Var *) node)->varlevelsup);
-               nfields = length(rte->eref->colnames);
+               nfields = list_length(rte->eref->colnames);
                for (nf = 1; nf <= nfields; nf++)
                {
                        Oid             vartype;
@@ -585,7 +585,7 @@ coerce_record_to_complex(ParseState *pstate, Node *node,
                                                format_type_be(targetTypeId))));
 
        tupdesc = lookup_rowtype_tupdesc(targetTypeId, -1);
-       if (length(args) != tupdesc->natts)
+       if (list_length(args) != tupdesc->natts)
                ereport(ERROR,
                                (errcode(ERRCODE_CANNOT_COERCE),
                                 errmsg("cannot cast type %s to %s",
@@ -728,7 +728,7 @@ select_common_type(List *typeids, const char *context)
 
        for_each_cell(type_item, lnext(list_head(typeids)))
        {
-               Oid                     ntype = getBaseType(lfirsto(type_item));
+               Oid                     ntype = getBaseType(lfirst_oid(type_item));
 
                /* move on to next one if no new information... */
                if ((ntype != InvalidOid) && (ntype != UNKNOWNOID) && (ntype != ptype))
index 9efebdf..5dbac63 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.171 2004/05/26 04:41:30 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.172 2004/05/30 23:40:35 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -153,8 +153,8 @@ transformExpr(ParseState *pstate, Node *expr)
                                foreach(fields, pref->fields)
                                {
                                        result = ParseFuncOrColumn(pstate,
-                                                                                          makeList1(lfirst(fields)),
-                                                                                          makeList1(result),
+                                                                                          list_make1(lfirst(fields)),
+                                                                                          list_make1(result),
                                                                                           false, false, true);
                                }
                                /* handle subscripts, if any */
@@ -183,8 +183,8 @@ transformExpr(ParseState *pstate, Node *expr)
                                foreach(fields, efs->fields)
                                {
                                        result = ParseFuncOrColumn(pstate,
-                                                                                          makeList1(lfirst(fields)),
-                                                                                          makeList1(result),
+                                                                                          list_make1(lfirst(fields)),
+                                                                                          list_make1(result),
                                                                                           false, false, true);
                                }
                                /* handle subscripts, if any */
@@ -218,7 +218,7 @@ transformExpr(ParseState *pstate, Node *expr)
                                                         * into IS NULL exprs.
                                                         */
                                                        if (Transform_null_equals &&
-                                                               length(a->name) == 1 &&
+                                                               list_length(a->name) == 1 &&
                                                                strcmp(strVal(linitial(a->name)), "=") == 0 &&
                                                                (exprIsNullConstant(lexpr) ||
                                                                 exprIsNullConstant(rexpr)))
@@ -284,8 +284,8 @@ transformExpr(ParseState *pstate, Node *expr)
                                                        rexpr = coerce_to_boolean(pstate, rexpr, "AND");
 
                                                        result = (Node *) makeBoolExpr(AND_EXPR,
-                                                                                                                makeList2(lexpr,
-                                                                                                                                rexpr));
+                                                                                                                  list_make2(lexpr,
+                                                                                                                                         rexpr));
                                                }
                                                break;
                                        case AEXPR_OR:
@@ -299,8 +299,8 @@ transformExpr(ParseState *pstate, Node *expr)
                                                        rexpr = coerce_to_boolean(pstate, rexpr, "OR");
 
                                                        result = (Node *) makeBoolExpr(OR_EXPR,
-                                                                                                                makeList2(lexpr,
-                                                                                                                                rexpr));
+                                                                                                                  list_make2(lexpr,
+                                                                                                                                         rexpr));
                                                }
                                                break;
                                        case AEXPR_NOT:
@@ -311,7 +311,7 @@ transformExpr(ParseState *pstate, Node *expr)
                                                        rexpr = coerce_to_boolean(pstate, rexpr, "NOT");
 
                                                        result = (Node *) makeBoolExpr(NOT_EXPR,
-                                                                                                          makeList1(rexpr));
+                                                                                                          list_make1(rexpr));
                                                }
                                                break;
                                        case AEXPR_OP_ANY:
@@ -446,7 +446,7 @@ transformExpr(ParseState *pstate, Node *expr)
                                 * XXX: repeated lappend() would no longer result in
                                 * O(n^2) behavior; worth reconsidering this design?
                                 */
-                               targs = listCopy(fn->args);
+                               targs = list_copy(fn->args);
                                foreach(args, targs)
                                {
                                        lfirst(args) = transformExpr(pstate,
@@ -474,7 +474,7 @@ transformExpr(ParseState *pstate, Node *expr)
                                }
                                pstate->p_hasSubLinks = true;
                                qtrees = parse_sub_analyze(sublink->subselect, pstate);
-                               if (length(qtrees) != 1)
+                               if (list_length(qtrees) != 1)
                                        elog(ERROR, "bad query in sub-select");
                                qtree = (Query *) linitial(qtrees);
                                if (qtree->commandType != CMD_SELECT ||
@@ -530,7 +530,7 @@ transformExpr(ParseState *pstate, Node *expr)
                                        /* ALL, ANY, or MULTIEXPR: generate operator list */
                                        List       *left_list = sublink->lefthand;
                                        List       *right_list = qtree->targetList;
-                                       int                     row_length = length(left_list);
+                                       int                     row_length = list_length(left_list);
                                        bool            needNot = false;
                                        List       *op = sublink->operName;
                                        char       *opname = strVal(llast(op));
@@ -548,11 +548,11 @@ transformExpr(ParseState *pstate, Node *expr)
                                         * pre-7.4 Postgres.
                                         */
                                        if (sublink->subLinkType == ALL_SUBLINK &&
-                                               length(op) == 1 && strcmp(opname, "<>") == 0)
+                                               list_length(op) == 1 && strcmp(opname, "<>") == 0)
                                        {
                                                sublink->subLinkType = ANY_SUBLINK;
                                                opname = pstrdup("=");
-                                               op = makeList1(makeString(opname));
+                                               op = list_make1(makeString(opname));
                                                sublink->operName = op;
                                                needNot = true;
                                        }
@@ -626,8 +626,8 @@ transformExpr(ParseState *pstate, Node *expr)
                                                                         opname),
                                                                         errhint("The operator of a quantified predicate subquery must return type boolean.")));
 
-                                               sublink->operOids = lappendo(sublink->operOids,
-                                                                                                        oprid(optup));
+                                               sublink->operOids = lappend_oid(sublink->operOids,
+                                                                                                               oprid(optup));
 
                                                ReleaseSysCache(optup);
                                        }
@@ -640,7 +640,7 @@ transformExpr(ParseState *pstate, Node *expr)
                                        {
                                                expr = coerce_to_boolean(pstate, expr, "NOT");
                                                expr = (Node *) makeBoolExpr(NOT_EXPR,
-                                                                                                        makeList1(expr));
+                                                                                                        list_make1(expr));
                                        }
                                }
                                result = (Node *) expr;
@@ -709,7 +709,7 @@ transformExpr(ParseState *pstate, Node *expr)
                                        neww->result = (Expr *) transformExpr(pstate, warg);
 
                                        newargs = lappend(newargs, neww);
-                                       typeids = lappendo(typeids, exprType((Node *) neww->result));
+                                       typeids = lappend_oid(typeids, exprType((Node *) neww->result));
                                }
 
                                newc->args = newargs;
@@ -731,7 +731,7 @@ transformExpr(ParseState *pstate, Node *expr)
                                 * code worked before, but it seems a little bogus to me
                                 * --- tgl
                                 */
-                               typeids = lconso(exprType((Node *) newc->defresult), typeids);
+                               typeids = lcons_oid(exprType((Node *) newc->defresult), typeids);
 
                                ptype = select_common_type(typeids, "CASE");
                                Assert(OidIsValid(ptype));
@@ -779,7 +779,7 @@ transformExpr(ParseState *pstate, Node *expr)
 
                                        newe = transformExpr(pstate, e);
                                        newelems = lappend(newelems, newe);
-                                       typeids = lappendo(typeids, exprType(newe));
+                                       typeids = lappend_oid(typeids, exprType(newe));
                                }
 
                                /* Select a common type for the elements */
@@ -868,7 +868,7 @@ transformExpr(ParseState *pstate, Node *expr)
 
                                        newe = transformExpr(pstate, e);
                                        newargs = lappend(newargs, newe);
-                                       typeids = lappendo(typeids, exprType(newe));
+                                       typeids = lappend_oid(typeids, exprType(newe));
                                }
 
                                newc->coalescetype = select_common_type(typeids, "COALESCE");
@@ -997,7 +997,7 @@ transformIndirection(ParseState *pstate, Node *basenode, List *indirection)
 static Node *
 transformColumnRef(ParseState *pstate, ColumnRef *cref)
 {
-       int                     numnames = length(cref->fields);
+       int                     numnames = list_length(cref->fields);
        Node       *node;
        int                     levels_up;
 
@@ -1095,8 +1095,8 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
                                         */
                                        node = transformWholeRowRef(pstate, NULL, name1);
                                        node = ParseFuncOrColumn(pstate,
-                                                                                        makeList1(makeString(name2)),
-                                                                                        makeList1(node),
+                                                                                        list_make1(makeString(name2)),
+                                                                                        list_make1(node),
                                                                                         false, false, true);
                                }
                                break;
@@ -1121,8 +1121,8 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
                                        /* Try it as a function call */
                                        node = transformWholeRowRef(pstate, name1, name2);
                                        node = ParseFuncOrColumn(pstate,
-                                                                                        makeList1(makeString(name3)),
-                                                                                        makeList1(node),
+                                                                                        list_make1(makeString(name3)),
+                                                                                        list_make1(node),
                                                                                         false, false, true);
                                }
                                break;
@@ -1157,8 +1157,8 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
                                        /* Try it as a function call */
                                        node = transformWholeRowRef(pstate, name2, name3);
                                        node = ParseFuncOrColumn(pstate,
-                                                                                        makeList1(makeString(name4)),
-                                                                                        makeList1(node),
+                                                                                        list_make1(makeString(name4)),
+                                                                                        list_make1(node),
                                                                                         false, false, true);
                                }
                                break;
@@ -1587,7 +1587,7 @@ exprIsLengthCoercion(Node *expr, int32 *coercedTypmod)
         * second argument being an int4 constant, it can't have been created
         * from a length coercion (it must be a type coercion, instead).
         */
-       nargs = length(func->args);
+       nargs = list_length(func->args);
        if (nargs < 2 || nargs > 3)
                return false;
 
@@ -1661,7 +1661,7 @@ make_row_op(ParseState *pstate, List *opname, Node *ltree, Node *rtree)
        largs = lrow->args;
        rargs = rrow->args;
 
-       if (length(largs) != length(rargs))
+       if (list_length(largs) != list_length(rargs))
                ereport(ERROR,
                                (errcode(ERRCODE_SYNTAX_ERROR),
                                 errmsg("unequal number of entries in row expression")));
@@ -1706,7 +1706,7 @@ make_row_op(ParseState *pstate, List *opname, Node *ltree, Node *rtree)
                        result = cmp;
                else
                        result = (Node *) makeBoolExpr(boolop,
-                                                                                  makeList2(result, cmp));
+                                                                                  list_make2(result, cmp));
        }
 
        if (result == NULL)
@@ -1744,7 +1744,7 @@ make_row_distinct_op(ParseState *pstate, List *opname,
        largs = lrow->args;
        rargs = rrow->args;
 
-       if (length(largs) != length(rargs))
+       if (list_length(largs) != list_length(rargs))
                ereport(ERROR,
                                (errcode(ERRCODE_SYNTAX_ERROR),
                                 errmsg("unequal number of entries in row expression")));
@@ -1760,7 +1760,7 @@ make_row_distinct_op(ParseState *pstate, List *opname,
                        result = cmp;
                else
                        result = (Node *) makeBoolExpr(OR_EXPR,
-                                                                                  makeList2(result, cmp));
+                                                                                  list_make2(result, cmp));
        }
 
        if (result == NULL)
index 2b48ef4..781c94f 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.169 2004/05/26 04:41:30 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.170 2004/05/30 23:40:35 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -69,7 +69,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
        Oid                     funcid;
        ListCell   *l;
        Node       *first_arg = NULL;
-       int                     nargs = length(fargs);
+       int                     nargs = list_length(fargs);
        int                     argn;
        Oid                     actual_arg_types[FUNC_MAX_ARGS];
        Oid                *declared_arg_types;
@@ -101,7 +101,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
         * then the "function call" could be a projection.      We also check that
         * there wasn't any aggregate decoration.
         */
-       if (nargs == 1 && !agg_star && !agg_distinct && length(funcname) == 1)
+       if (nargs == 1 && !agg_star && !agg_distinct && list_length(funcname) == 1)
        {
                Oid                     argtype = exprType(first_arg);
 
@@ -182,7 +182,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
                if (is_column)
                {
                        Assert(nargs == 1);
-                       Assert(length(funcname) == 1);
+                       Assert(list_length(funcname) == 1);
                        unknown_attribute(pstate, first_arg, strVal(linitial(funcname)));
                }
 
@@ -974,8 +974,8 @@ find_inheritors(Oid relid, Oid **supervec)
        else
                *supervec = NULL;
 
-       freeList(visited);
-       freeList(queue);
+       list_free(visited);
+       list_free(queue);
 
        return nvisited;
 }
@@ -1400,7 +1400,7 @@ LookupFuncNameTypeNames(List *funcname, List *argtypes, bool noError)
        ListCell   *args_item;
 
        MemSet(argoids, 0, FUNC_MAX_ARGS * sizeof(Oid));
-       argcount = length(argtypes);
+       argcount = list_length(argtypes);
        if (argcount > FUNC_MAX_ARGS)
                ereport(ERROR,
                                (errcode(ERRCODE_TOO_MANY_ARGUMENTS),
index 51d780d..7c1f8e5 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.77 2003/11/29 19:51:52 pgsql Exp $
+ *       $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.78 2004/05/30 23:40:35 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -881,7 +881,7 @@ make_scalar_array_op(ParseState *pstate, List *opname,
        tup = oper(opname, ltypeId, rtypeId, false);
        opform = (Form_pg_operator) GETSTRUCT(tup);
 
-       args = makeList2(ltree, rtree);
+       args = list_make2(ltree, rtree);
        actual_arg_types[0] = ltypeId;
        actual_arg_types[1] = rtypeId;
        declared_arg_types[0] = opform->oprleft;
@@ -960,7 +960,7 @@ make_op_expr(ParseState *pstate, Operator op,
        if (rtree == NULL)
        {
                /* right operator */
-               args = makeList1(ltree);
+               args = list_make1(ltree);
                actual_arg_types[0] = ltypeId;
                declared_arg_types[0] = opform->oprleft;
                nargs = 1;
@@ -968,7 +968,7 @@ make_op_expr(ParseState *pstate, Operator op,
        else if (ltree == NULL)
        {
                /* left operator */
-               args = makeList1(rtree);
+               args = list_make1(rtree);
                actual_arg_types[0] = rtypeId;
                declared_arg_types[0] = opform->oprright;
                nargs = 1;
@@ -976,7 +976,7 @@ make_op_expr(ParseState *pstate, Operator op,
        else
        {
                /* otherwise, binary operator */
-               args = makeList2(ltree, rtree);
+               args = list_make2(ltree, rtree);
                actual_arg_types[0] = ltypeId;
                actual_arg_types[1] = rtypeId;
                declared_arg_types[0] = opform->oprleft;
index d7d50e1..fcec2cb 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.95 2004/05/26 04:41:30 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.96 2004/05/30 23:40:35 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -436,7 +436,7 @@ GetRTEByRangeTablePosn(ParseState *pstate,
                pstate = pstate->parentParseState;
                Assert(pstate != NULL);
        }
-       Assert(varno > 0 && varno <= length(pstate->p_rtable));
+       Assert(varno > 0 && varno <= list_length(pstate->p_rtable));
        return rt_fetch(varno, pstate->p_rtable);
 }
 
@@ -674,7 +674,7 @@ addRangeTableEntry(ParseState *pstate,
        rte->relid = RelationGetRelid(rel);
 
        eref = alias ? (Alias *) copyObject(alias) : makeAlias(refname, NIL);
-       numaliases = length(eref->colnames);
+       numaliases = list_length(eref->colnames);
 
        /*
         * Since the rel is open anyway, let's check that the number of column
@@ -768,7 +768,7 @@ addRangeTableEntryForRelation(ParseState *pstate,
        rte->relid = relid;
 
        eref = (Alias *) copyObject(alias);
-       numaliases = length(eref->colnames);
+       numaliases = list_length(eref->colnames);
 
        /*
         * Since the rel is open anyway, let's check that the number of column
@@ -849,7 +849,7 @@ addRangeTableEntryForSubquery(ParseState *pstate,
        rte->alias = alias;
 
        eref = copyObject(alias);
-       numaliases = length(eref->colnames);
+       numaliases = list_length(eref->colnames);
 
        /* fill in any unspecified alias columns */
        varattno = 0;
@@ -933,7 +933,7 @@ addRangeTableEntryForFunction(ParseState *pstate,
        eref = alias ? (Alias *) copyObject(alias) : makeAlias(funcname, NIL);
        rte->eref = eref;
 
-       numaliases = length(eref->colnames);
+       numaliases = list_length(eref->colnames);
 
        /*
         * Now determine if the function returns a simple or composite type,
@@ -1023,7 +1023,7 @@ addRangeTableEntryForFunction(ParseState *pstate,
                          errmsg("too many column aliases specified for function %s",
                                         funcname)));
                if (numaliases == 0)
-                       eref->colnames = makeList1(makeString(eref->aliasname));
+                       eref->colnames = list_make1(makeString(eref->aliasname));
        }
        else if (functyptype == 'p' && funcrettype == RECORDOID)
        {
@@ -1097,12 +1097,12 @@ addRangeTableEntryForJoin(ParseState *pstate,
        rte->alias = alias;
 
        eref = alias ? (Alias *) copyObject(alias) : makeAlias("unnamed_join", NIL);
-       numaliases = length(eref->colnames);
+       numaliases = list_length(eref->colnames);
 
        /* fill in any unspecified alias columns */
-       if (numaliases < length(colnames))
-               eref->colnames = nconc(eref->colnames,
-                                                          list_copy_tail(colnames, numaliases));
+       if (numaliases < list_length(colnames))
+               eref->colnames = list_concat(eref->colnames,
+                                                                        list_copy_tail(colnames, numaliases));
 
        rte->eref = eref;
 
@@ -1241,7 +1241,7 @@ expandRTE(ParseState *pstate, RangeTblEntry *rte,
 
                                rel = heap_open(rte->relid, AccessShareLock);
                                maxattrs = RelationGetNumberOfAttributes(rel);
-                               numaliases = length(rte->eref->colnames);
+                               numaliases = list_length(rte->eref->colnames);
 
                                for (varattno = 0; varattno < maxattrs; varattno++)
                                {
@@ -1255,7 +1255,7 @@ expandRTE(ParseState *pstate, RangeTblEntry *rte,
                                                char       *label;
 
                                                if (varattno < numaliases)
-                                                       label = strVal(nth(varattno, rte->eref->colnames));
+                                                       label = strVal(list_nth(rte->eref->colnames, varattno));
                                                else
                                                        label = NameStr(attr->attname);
                                                *colnames = lappend(*colnames, makeString(pstrdup(label)));
@@ -1339,7 +1339,7 @@ expandRTE(ParseState *pstate, RangeTblEntry *rte,
 
                                        rel = relation_open(funcrelid, AccessShareLock);
                                        maxattrs = RelationGetNumberOfAttributes(rel);
-                                       numaliases = length(rte->eref->colnames);
+                                       numaliases = list_length(rte->eref->colnames);
 
                                        for (varattno = 0; varattno < maxattrs; varattno++)
                                        {
@@ -1353,7 +1353,7 @@ expandRTE(ParseState *pstate, RangeTblEntry *rte,
                                                        char       *label;
 
                                                        if (varattno < numaliases)
-                                                               label = strVal(nth(varattno, rte->eref->colnames));
+                                                               label = strVal(list_nth(rte->eref->colnames, varattno));
                                                        else
                                                                label = NameStr(attr->attname);
                                                        *colnames = lappend(*colnames, makeString(pstrdup(label)));
@@ -1442,7 +1442,7 @@ expandRTE(ParseState *pstate, RangeTblEntry *rte,
                                ListCell        *colname;
                                ListCell        *aliasvar;
 
-                               Assert(length(rte->eref->colnames) == length(rte->joinaliasvars));
+                               Assert(list_length(rte->eref->colnames) == list_length(rte->joinaliasvars));
 
                                varattno = 0;
                                forboth (colname, rte->eref->colnames, aliasvar, rte->joinaliasvars)
@@ -1533,8 +1533,8 @@ get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum)
         * If there is a user-written column alias, use it.
         */
        if (rte->alias &&
-               attnum > 0 && attnum <= length(rte->alias->colnames))
-               return strVal(nth(attnum - 1, rte->alias->colnames));
+               attnum > 0 && attnum <= list_length(rte->alias->colnames))
+               return strVal(list_nth(rte->alias->colnames, attnum - 1));
 
        /*
         * If the RTE is a relation, go to the system catalogs not the
@@ -1549,8 +1549,8 @@ get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum)
         * Otherwise use the column name from eref.  There should always be
         * one.
         */
-       if (attnum > 0 && attnum <= length(rte->eref->colnames))
-               return strVal(nth(attnum - 1, rte->eref->colnames));
+       if (attnum > 0 && attnum <= list_length(rte->eref->colnames))
+               return strVal(list_nth(rte->eref->colnames, attnum - 1));
 
        /* else caller gave us a bogus attnum */
        elog(ERROR, "invalid attnum %d for rangetable entry %s",
@@ -1665,7 +1665,7 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
                                }
                                else if (functyptype == 'p' && funcrettype == RECORDOID)
                                {
-                                       ColumnDef  *colDef = nth(attnum - 1, coldeflist);
+                                       ColumnDef  *colDef = list_nth(coldeflist, attnum - 1);
 
                                        *vartype = typenameTypeId(colDef->typename);
                                        *vartypmod = -1;
@@ -1684,8 +1684,8 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
                                 */
                                Node       *aliasvar;
 
-                               Assert(attnum > 0 && attnum <= length(rte->joinaliasvars));
-                               aliasvar = (Node *) nth(attnum - 1, rte->joinaliasvars);
+                               Assert(attnum > 0 && attnum <= list_length(rte->joinaliasvars));
+                               aliasvar = (Node *) list_nth(rte->joinaliasvars, attnum - 1);
                                *vartype = exprType(aliasvar);
                                *vartypmod = exprTypmod(aliasvar);
                        }
@@ -1777,8 +1777,8 @@ get_rte_attribute_is_dropped(RangeTblEntry *rte, AttrNumber attnum)
  *
  * Returns NULL if resno is not present in list.
  *
- * Note: we need to search, rather than just indexing with nth(), because
- * not all tlists are sorted by resno.
+ * Note: we need to search, rather than just indexing with list_nth(),
+ * because not all tlists are sorted by resno.
  */
 TargetEntry *
 get_tle_by_resno(List *tlist, AttrNumber resno)
index 9eaf9eb..2cf870d 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.118 2004/05/26 04:41:30 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.119 2004/05/30 23:40:35 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -108,7 +108,7 @@ transformTargetList(ParseState *pstate, List *targetlist)
 
                        if (strcmp(strVal(llast(fields)), "*") == 0)
                        {
-                               int             numnames = length(fields);
+                               int             numnames = list_length(fields);
 
                                if (numnames == 1)
                                {
@@ -268,8 +268,8 @@ markTargetListOrigin(ParseState *pstate, Resdom *res, Var *var)
                                /* Join RTE --- recursively inspect the alias variable */
                                Var                *aliasvar;
 
-                               Assert(attnum > 0 && attnum <= length(rte->joinaliasvars));
-                               aliasvar = (Var *) nth(attnum - 1, rte->joinaliasvars);
+                               Assert(attnum > 0 && attnum <= list_length(rte->joinaliasvars));
+                               aliasvar = (Var *) list_nth(rte->joinaliasvars, attnum - 1);
                                markTargetListOrigin(pstate, res, aliasvar);
                        }
                        break;
@@ -460,7 +460,7 @@ checkInsertTargets(ParseState *pstate, List *cols, List **attrnos)
                        col->indirection = NIL;
                        col->val = NULL;
                        cols = lappend(cols, col);
-                       *attrnos = lappendi(*attrnos, i + 1);
+                       *attrnos = lappend_int(*attrnos, i + 1);
                }
        }
        else
@@ -478,12 +478,12 @@ checkInsertTargets(ParseState *pstate, List *cols, List **attrnos)
                        /* Lookup column name, ereport on failure */
                        attrno = attnameAttNum(pstate->p_target_relation, name, false);
                        /* Check for duplicates */
-                       if (intMember(attrno, *attrnos))
+                       if (list_member_int(*attrnos, attrno))
                                ereport(ERROR,
                                                (errcode(ERRCODE_DUPLICATE_COLUMN),
                                          errmsg("column \"%s\" specified more than once",
                                                         name)));
-                       *attrnos = lappendi(*attrnos, attrno);
+                       *attrnos = lappend_int(*attrnos, attrno);
                }
        }
 
@@ -529,7 +529,7 @@ ExpandAllTables(ParseState *pstate)
                        continue;
 
                found_table = true;
-               target = nconc(target, expandRelAttrs(pstate, rte));
+               target = list_concat(target, expandRelAttrs(pstate, rte));
        }
 
        /* Check for SELECT *; */
index 473d523..3dc1622 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/parser/parse_type.c,v 1.66 2004/05/26 04:41:30 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/parser/parse_type.c,v 1.67 2004/05/30 23:40:35 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -54,7 +54,7 @@ LookupTypeName(const TypeName *typename)
                AttrNumber      attnum;
 
                /* deconstruct the name list */
-               switch (length(typename->names))
+               switch (list_length(typename->names))
                {
                        case 1:
                                ereport(ERROR,
@@ -486,7 +486,7 @@ parseTypeString(const char *str, Oid *type_id, int32 *typmod)
         * Make sure we got back exactly what we expected and no more;
         * paranoia is justified since the string might contain anything.
         */
-       if (length(raw_parsetree_list) != 1)
+       if (list_length(raw_parsetree_list) != 1)
                goto fail;
        stmt = (SelectStmt *) linitial(raw_parsetree_list);
        if (stmt == NULL ||
@@ -503,7 +503,7 @@ parseTypeString(const char *str, Oid *type_id, int32 *typmod)
                stmt->forUpdate != NIL ||
                stmt->op != SETOP_NONE)
                goto fail;
-       if (length(stmt->targetList) != 1)
+       if (list_length(stmt->targetList) != 1)
                goto fail;
        restarget = (ResTarget *) linitial(stmt->targetList);
        if (restarget == NULL ||
index 685eebc..ce82f37 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.95 2004/05/26 04:41:33 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.96 2004/05/30 23:40:35 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -251,7 +251,7 @@ DefineQueryRewrite(RuleStmt *stmt)
                /*
                 * So there cannot be INSTEAD NOTHING, ...
                 */
-               if (length(action) == 0)
+               if (list_length(action) == 0)
                        ereport(ERROR,
                                        (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                        errmsg("INSTEAD NOTHING rules on SELECT are not implemented"),
@@ -260,7 +260,7 @@ DefineQueryRewrite(RuleStmt *stmt)
                /*
                 * ... there cannot be multiple actions, ...
                 */
-               if (length(action) > 1)
+               if (list_length(action) > 1)
                        ereport(ERROR,
                                        (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                                         errmsg("multiple actions for rules on SELECT are not implemented")));
index cc1c454..cf6281d 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.137 2004/05/29 05:55:13 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.138 2004/05/30 23:40:35 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -82,7 +82,7 @@ rewriteRuleAction(Query *parsetree,
        rule_qual = (Node *) copyObject(rule_qual);
 
        current_varno = rt_index;
-       rt_length = length(parsetree->rtable);
+       rt_length = list_length(parsetree->rtable);
        new_varno = PRS2_NEW_VARNO + rt_length;
 
        /*
@@ -131,7 +131,7 @@ rewriteRuleAction(Query *parsetree,
         * that rule action's rtable is separate and shares no substructure
         * with the main rtable.  Hence do a deep copy here.
         */
-       sub_action->rtable = nconc((List *) copyObject(parsetree->rtable),
+       sub_action->rtable = list_concat((List *) copyObject(parsetree->rtable),
                                                           sub_action->rtable);
 
        /*
@@ -174,7 +174,7 @@ rewriteRuleAction(Query *parsetree,
                                                 errmsg("conditional UNION/INTERSECT/EXCEPT statements are not implemented")));
 
                        sub_action->jointree->fromlist =
-                               nconc(newjointree, sub_action->jointree->fromlist);
+                               list_concat(newjointree, sub_action->jointree->fromlist);
                }
        }
 
@@ -249,8 +249,8 @@ adjustJoinTreeList(Query *parsetree, bool removert, int rt_index)
                        if (IsA(rtr, RangeTblRef) &&
                                rtr->rtindex == rt_index)
                        {
-                               newjointree = lremove(rtr, newjointree);
-                               /* foreach is safe because we exit loop after lremove... */
+                               newjointree = list_delete_ptr(newjointree, rtr);
+                               /* foreach is safe because we exit loop after list_delete... */
                                break;
                        }
                }
@@ -616,7 +616,7 @@ ApplyRetrieveRule(Query *parsetree,
        RangeTblEntry *rte,
                           *subrte;
 
-       if (length(rule->actions) != 1)
+       if (list_length(rule->actions) != 1)
                elog(ERROR, "expected just one rule action");
        if (rule->qual != NULL)
                elog(ERROR, "cannot handle qualified ON SELECT rule");
@@ -657,14 +657,14 @@ ApplyRetrieveRule(Query *parsetree,
        /*
         * FOR UPDATE of view?
         */
-       if (intMember(rt_index, parsetree->rowMarks))
+       if (list_member_int(parsetree->rowMarks, rt_index))
        {
                /*
                 * Remove the view from the list of rels that will actually be
                 * marked FOR UPDATE by the executor.  It will still be access-
                 * checked for write access, though.
                 */
-               parsetree->rowMarks = lremovei(rt_index, parsetree->rowMarks);
+               parsetree->rowMarks = list_delete_int(parsetree->rowMarks, rt_index);
 
                /*
                 * Set up the view's referenced tables as if FOR UPDATE.
@@ -702,8 +702,8 @@ markQueryForUpdate(Query *qry, bool skipOldNew)
 
                if (rte->rtekind == RTE_RELATION)
                {
-                       if (!intMember(rti, qry->rowMarks))
-                               qry->rowMarks = lappendi(qry->rowMarks, rti);
+                       if (!list_member_int(qry->rowMarks, rti))
+                               qry->rowMarks = lappend_int(qry->rowMarks, rti);
                        rte->requiredPerms |= ACL_SELECT_FOR_UPDATE;
                }
                else if (rte->rtekind == RTE_SUBQUERY)
@@ -766,7 +766,7 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
         * can get changed each time through...
         */
        rt_index = 0;
-       while (rt_index < length(parsetree->rtable))
+       while (rt_index < list_length(parsetree->rtable))
        {
                RangeTblEntry *rte;
                Relation        rel;
@@ -825,7 +825,7 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
                 */
                if (rt_index == parsetree->resultRelation)
                        lockmode = NoLock;
-               else if (intMember(rt_index, parsetree->rowMarks))
+               else if (list_member_int(parsetree->rowMarks, rt_index))
                        lockmode = RowShareLock;
                else
                        lockmode = AccessShareLock;
@@ -866,12 +866,12 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
                {
                        ListCell   *l;
 
-                       if (oidMember(RelationGetRelid(rel), activeRIRs))
+                       if (list_member_oid(activeRIRs, RelationGetRelid(rel)))
                                ereport(ERROR,
                                                (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
                                                 errmsg("infinite recursion detected in rules for relation \"%s\"",
                                                                RelationGetRelationName(rel))));
-                       activeRIRs = lconso(RelationGetRelid(rel), activeRIRs);
+                       activeRIRs = lcons_oid(RelationGetRelid(rel), activeRIRs);
 
                        foreach(l, locks)
                        {
@@ -1169,7 +1169,7 @@ RewriteQuery(Query *parsetree, List *rewrite_events)
                                        List       *newstuff;
 
                                        newstuff = RewriteQuery(pt, rewrite_events);
-                                       rewritten = nconc(rewritten, newstuff);
+                                       rewritten = list_concat(rewritten, newstuff);
                                }
                        }
                }
index 4079230..d8cd7de 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.83 2004/05/26 04:41:33 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.84 2004/05/30 23:40:35 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -231,7 +231,7 @@ OffsetVarNodes(Node *node, int offset, int sublevels_up)
                        if (qry->resultRelation)
                                qry->resultRelation += offset;
                        foreach(l, qry->rowMarks)
-                               lfirsti(l) += offset;
+                               lfirst_int(l) += offset;
                }
                query_tree_walker(qry, OffsetVarNodes_walker,
                                                  (void *) &context, 0);
@@ -373,8 +373,8 @@ ChangeVarNodes(Node *node, int rt_index, int new_index, int sublevels_up)
                                qry->resultRelation = new_index;
                        foreach(l, qry->rowMarks)
                        {
-                               if (lfirsti(l) == rt_index)
-                                       lfirsti(l) = new_index;
+                               if (lfirst_int(l) == rt_index)
+                                       lfirst_int(l) = new_index;
                        }
                }
                query_tree_walker(qry, ChangeVarNodes_walker,
@@ -671,14 +671,14 @@ getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr)
         * query.  If they're not there, it must be an INSERT/SELECT in which
         * they've been pushed down to the SELECT.
         */
-       if (length(parsetree->rtable) >= 2 &&
+       if (list_length(parsetree->rtable) >= 2 &&
         strcmp(rt_fetch(PRS2_OLD_VARNO, parsetree->rtable)->eref->aliasname,
                        "*OLD*") == 0 &&
         strcmp(rt_fetch(PRS2_NEW_VARNO, parsetree->rtable)->eref->aliasname,
                        "*NEW*") == 0)
                return parsetree;
        Assert(parsetree->jointree && IsA(parsetree->jointree, FromExpr));
-       if (length(parsetree->jointree->fromlist) != 1)
+       if (list_length(parsetree->jointree->fromlist) != 1)
                elog(ERROR, "expected to find SELECT subquery");
        rtr = (RangeTblRef *) linitial(parsetree->jointree->fromlist);
        Assert(IsA(rtr, RangeTblRef));
@@ -687,7 +687,7 @@ getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr)
        if (!(selectquery && IsA(selectquery, Query) &&
                  selectquery->commandType == CMD_SELECT))
                elog(ERROR, "expected to find SELECT subquery");
-       if (length(selectquery->rtable) >= 2 &&
+       if (list_length(selectquery->rtable) >= 2 &&
        strcmp(rt_fetch(PRS2_OLD_VARNO, selectquery->rtable)->eref->aliasname,
                   "*OLD*") == 0 &&
        strcmp(rt_fetch(PRS2_NEW_VARNO, selectquery->rtable)->eref->aliasname,
@@ -933,7 +933,7 @@ ResolveNew_mutator(Node *node, ResolveNew_context *context)
                                RangeTblEntry *rte = context->target_rte;
                                RowExpr *rowexpr;
                                List    *fields = NIL;
-                               AttrNumber nfields = length(rte->eref->colnames);
+                               AttrNumber nfields = list_length(rte->eref->colnames);
                                AttrNumber nf;
 
                                for (nf = 1; nf <= nfields; nf++)
index bb34667..ecac8d2 100644 (file)
@@ -14,7 +14,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/name.c,v 1.51 2004/05/26 04:41:37 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/name.c,v 1.52 2004/05/30 23:40:35 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -360,7 +360,7 @@ current_schemas(PG_FUNCTION_ARGS)
 
        /* +1 here is just to avoid palloc(0) error */
 
-       names = (Datum *) palloc((length(search_path) + 1) * sizeof(Datum));
+       names = (Datum *) palloc((list_length(search_path) + 1) * sizeof(Datum));
        i = 0;
        foreach(l, search_path)
        {
index 8222e33..e3fb57d 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/not_in.c,v 1.38 2003/11/29 19:51:59 pgsql Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/not_in.c,v 1.39 2004/05/30 23:40:35 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -57,14 +57,14 @@ int4notin(PG_FUNCTION_ARGS)
        /* Parse the argument */
 
        names = textToQualifiedNameList(relation_and_attr, "int4notin");
-       nnames = length(names);
+       nnames = list_length(names);
        if (nnames < 2)
                ereport(ERROR,
                                (errcode(ERRCODE_INVALID_NAME),
                                 errmsg("invalid name syntax"),
                           errhint("Must provide \"relationname.columnname\".")));
        attribute = strVal(llast(names));
-       names = ltruncate(nnames - 1, names);
+       names = list_truncate(names, nnames - 1);
        relrv = makeRangeVarFromNameList(names);
 
        /* Open the relation and get a relation descriptor */
index 9c68840..cd4f1fe 100644 (file)
@@ -13,7 +13,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/regproc.c,v 1.88 2004/05/26 04:41:37 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/regproc.c,v 1.89 2004/05/30 23:40:36 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -188,7 +188,7 @@ regprocout(PG_FUNCTION_ARGS)
                         * Would this proc be found (uniquely!) by regprocin? If not,
                         * qualify it.
                         */
-                       clist = FuncnameGetCandidates(makeList1(makeString(proname)), -1);
+                       clist = FuncnameGetCandidates(list_make1(makeString(proname)), -1);
                        if (clist != NULL && clist->next == NULL &&
                                clist->oid == proid)
                                nspname = NULL;
@@ -536,7 +536,7 @@ regoperout(PG_FUNCTION_ARGS)
                         * Would this oper be found (uniquely!) by regoperin? If not,
                         * qualify it.
                         */
-                       clist = OpernameGetCandidates(makeList1(makeString(oprname)),
+                       clist = OpernameGetCandidates(list_make1(makeString(oprname)),
                                                                                  '\0');
                        if (clist != NULL && clist->next == NULL &&
                                clist->oid == oprid)
@@ -1122,7 +1122,7 @@ stringToQualifiedNameList(const char *string, const char *caller)
        }
 
        pfree(rawname);
-       freeList(namelist);
+       list_free(namelist);
 
        return result;
 }
index 9e3a06c..253323c 100644 (file)
@@ -17,7 +17,7 @@
  *
  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.68 2004/05/26 04:41:38 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.69 2004/05/30 23:40:36 neilc Exp $
  *
  * ----------
  */
@@ -2712,7 +2712,7 @@ RI_Initial_Check(FkConstraint *fkconstraint, Relation rel, Relation pkrel)
        {
                HeapTuple       tuple = SPI_tuptable->vals[0];
                TupleDesc       tupdesc = SPI_tuptable->tupdesc;
-               int                     nkeys = length(fkconstraint->fk_attrs);
+               int                     nkeys = list_length(fkconstraint->fk_attrs);
                int                     i;
                RI_QueryKey     qkey;
 
index 0356b18..8614e73 100644 (file)
@@ -3,7 +3,7 @@
  *                             back to source text
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.168 2004/05/26 19:30:12 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.169 2004/05/30 23:40:36 neilc Exp $
  *
  *       This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -1290,12 +1290,12 @@ deparse_context_for(const char *aliasname, Oid relid)
        rte->inFromCl = true;
 
        /* Build one-element rtable */
-       dpns->rtable = makeList1(rte);
+       dpns->rtable = list_make1(rte);
        dpns->outer_varno = dpns->inner_varno = 0;
        dpns->outer_rte = dpns->inner_rte = NULL;
 
        /* Return a one-deep namespace stack */
-       return makeList1(dpns);
+       return list_make1(dpns);
 }
 
 /*
@@ -1327,7 +1327,7 @@ deparse_context_for_plan(int outer_varno, Node *outercontext,
        dpns->inner_rte = (RangeTblEntry *) innercontext;
 
        /* Return a one-deep namespace stack */
-       return makeList1(dpns);
+       return list_make1(dpns);
 }
 
 /*
@@ -1360,7 +1360,7 @@ deparse_context_for_subplan(const char *name, List *tlist,
        RangeTblEntry *rte = makeNode(RangeTblEntry);
        List       *attrs = NIL;
        int                     nattrs = 0;
-       int                     rtablelength = length(rtable);
+       int                     rtablelength = list_length(rtable);
        ListCell   *tl;
        char            buf[32];
 
@@ -1539,8 +1539,8 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
                query = getInsertSelectQuery(query, NULL);
 
                context.buf = buf;
-               context.namespaces = makeList1(&dpns);
-               context.varprefix = (length(query->rtable) != 1);
+               context.namespaces = list_make1(&dpns);
+               context.varprefix = (list_length(query->rtable) != 1);
                context.prettyFlags = prettyFlags;
                context.indentLevel = PRETTYINDENT_STD;
                dpns.rtable = query->rtable;
@@ -1557,7 +1557,7 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
                appendStringInfo(buf, "INSTEAD ");
 
        /* Finally the rules actions */
-       if (length(actions) > 1)
+       if (list_length(actions) > 1)
        {
                ListCell   *action;
                Query      *query;
@@ -1574,7 +1574,7 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
                }
                appendStringInfo(buf, ");");
        }
-       else if (length(actions) == 0)
+       else if (list_length(actions) == 0)
        {
                appendStringInfo(buf, "NOTHING;");
        }
@@ -1633,7 +1633,7 @@ make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
        if (ev_action != NULL)
                actions = (List *) stringToNode(ev_action);
 
-       if (length(actions) != 1)
+       if (list_length(actions) != 1)
        {
                appendStringInfo(buf, "Not a view");
                return;
@@ -1675,7 +1675,7 @@ get_query_def(Query *query, StringInfo buf, List *parentnamespace,
        context.buf = buf;
        context.namespaces = lcons(&dpns, list_copy(parentnamespace));
        context.varprefix = (parentnamespace != NIL ||
-                                                length(query->rtable) != 1);
+                                                list_length(query->rtable) != 1);
        context.prettyFlags = prettyFlags;
        context.indentLevel = startIndent;
 
@@ -2284,7 +2284,7 @@ get_names_for_var(Var *var, deparse_context *context,
                                                                                  var->varlevelsup);
 
        /* Find the relevant RTE */
-       if (var->varno >= 1 && var->varno <= length(dpns->rtable))
+       if (var->varno >= 1 && var->varno <= list_length(dpns->rtable))
                rte = rt_fetch(var->varno, dpns->rtable);
        else if (var->varno == dpns->outer_varno)
                rte = dpns->outer_rte;
@@ -2393,7 +2393,7 @@ get_simple_binary_op_name(OpExpr *expr)
 {
        List       *args = expr->args;
 
-       if (length(args) == 2)
+       if (list_length(args) == 2)
        {
                /* binary operator */
                Node       *arg1 = (Node *) linitial(args);
@@ -3063,7 +3063,7 @@ get_rule_expr(Node *node, deparse_context *context,
                                char       *sep;
 
                                /*
-                                * SQL99 allows "ROW" to be omitted when length(args) > 1,
+                                * SQL99 allows "ROW" to be omitted when list_length(args) > 1,
                                 * but for simplicity we always print it.
                                 */
                                appendStringInfo(buf, "ROW(");
@@ -3240,7 +3240,7 @@ get_oper_expr(OpExpr *expr, deparse_context *context)
 
        if (!PRETTY_PAREN(context))
                appendStringInfoChar(buf, '(');
-       if (length(args) == 2)
+       if (list_length(args) == 2)
        {
                /* binary operator */
                Node       *arg1 = (Node *) linitial(args);
@@ -3595,7 +3595,7 @@ get_sublink_expr(SubLink *sublink, deparse_context *context)
 
        if (sublink->lefthand != NIL)
        {
-               need_paren = (length(sublink->lefthand) > 1);
+               need_paren = (list_length(sublink->lefthand) > 1);
                if (need_paren)
                        appendStringInfoChar(buf, '(');
 
@@ -3628,7 +3628,7 @@ get_sublink_expr(SubLink *sublink, deparse_context *context)
                        break;
 
                case ANY_SUBLINK:
-                       if (length(sublink->operName) == 1 &&
+                       if (list_length(sublink->operName) == 1 &&
                                strcmp(strVal(linitial(sublink->operName)), "=") == 0)
                        {
                                /* Represent = ANY as IN */
@@ -4244,7 +4244,7 @@ generate_function_name(Oid funcid, int nargs, Oid *argtypes)
         * resolve the correct function given the unqualified func name with
         * the specified argtypes.
         */
-       p_result = func_get_detail(makeList1(makeString(proname)),
+       p_result = func_get_detail(list_make1(makeString(proname)),
                                                           NIL, nargs, argtypes,
                                                           &p_funcid, &p_rettype,
                                                           &p_retset, &p_true_typeids);
@@ -4300,13 +4300,13 @@ generate_operator_name(Oid operid, Oid arg1, Oid arg2)
        switch (operform->oprkind)
        {
                case 'b':
-                       p_result = oper(makeList1(makeString(oprname)), arg1, arg2, true);
+                       p_result = oper(list_make1(makeString(oprname)), arg1, arg2, true);
                        break;
                case 'l':
-                       p_result = left_oper(makeList1(makeString(oprname)), arg2, true);
+                       p_result = left_oper(list_make1(makeString(oprname)), arg2, true);
                        break;
                case 'r':
-                       p_result = right_oper(makeList1(makeString(oprname)), arg1, true);
+                       p_result = right_oper(list_make1(makeString(oprname)), arg1, true);
                        break;
                default:
                        elog(ERROR, "unrecognized oprkind: %d", operform->oprkind);
@@ -4342,7 +4342,7 @@ static void
 print_operator_name(StringInfo buf, List *opname)
 {
        ListCell        *op = list_head(opname);
-       int                      nnames = length(opname);
+       int                      nnames = list_length(opname);
 
        if (nnames == 1)
                appendStringInfoString(buf, strVal(lfirst(op)));
index cd9a644..75eb0d2 100644 (file)
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.159 2004/05/26 04:41:39 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.160 2004/05/30 23:40:36 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -983,7 +983,7 @@ patternsel(PG_FUNCTION_ARGS, Pattern_Type ptype)
 
                if (eqopr == InvalidOid)
                        elog(ERROR, "no = operator for opclass %u", opclass);
-               eqargs = makeList2(vardata.var, prefix);
+               eqargs = list_make2(vardata.var, prefix);
                result = DatumGetFloat8(DirectFunctionCall4(eqsel,
                                                                                                        PointerGetDatum(root),
                                                                                                 ObjectIdGetDatum(eqopr),
@@ -1966,15 +1966,15 @@ estimate_num_groups(Query *root, List *groupExprs, double input_rows)
                                return input_rows;
                        continue;
                }
-               allvars = nconc(allvars, varshere);
+               allvars = list_concat(allvars, varshere);
        }
 
        /* If now no Vars, we must have an all-constant GROUP BY list. */
        if (allvars == NIL)
                return 1.0;
 
-       /* Use set_union() to discard duplicates */
-       allvars = set_union(NIL, allvars);
+       /* Use list_union() to discard duplicates */
+       allvars = list_union(NIL, allvars);
 
        /*
         * Step 2: acquire statistical estimate of number of distinct values
@@ -1993,13 +1993,13 @@ estimate_num_groups(Query *root, List *groupExprs, double input_rows)
                ndistinct = get_variable_numdistinct(&vardata);
                ReleaseVariableStats(vardata);
 
-               /* cannot use foreach here because of possible lremove */
+               /* cannot use foreach here because of possible list_delete */
                l2 = list_head(varinfos);
                while (l2)
                {
                        MyVarInfo  *varinfo = (MyVarInfo *) lfirst(l2);
 
-                       /* must advance l2 before lremove possibly pfree's it */
+                       /* must advance l2 before list_delete possibly pfree's it */
                        l2 = lnext(l2);
 
                        if (var->varno != varinfo->var->varno &&
@@ -2015,7 +2015,7 @@ estimate_num_groups(Query *root, List *groupExprs, double input_rows)
                                else
                                {
                                        /* Delete the older item */
-                                       varinfos = lremove(varinfo, varinfos);
+                                       varinfos = list_delete_ptr(varinfos, varinfo);
                                }
                        }
                }
@@ -2841,7 +2841,7 @@ get_restriction_variable(Query *root, List *args, int varRelid,
        VariableStatData rdata;
 
        /* Fail if not a binary opclause (probably shouldn't happen) */
-       if (length(args) != 2)
+       if (list_length(args) != 2)
                return false;
 
        left = (Node *) linitial(args);
@@ -2892,7 +2892,7 @@ get_join_variables(Query *root, List *args,
        Node       *left,
                           *right;
 
-       if (length(args) != 2)
+       if (list_length(args) != 2)
                elog(ERROR, "join operator should take two arguments");
 
        left = (Node *) linitial(args);
@@ -3654,7 +3654,7 @@ prefix_selectivity(Query *root, VariableStatData *vardata,
                                                                BTGreaterEqualStrategyNumber);
        if (cmpopr == InvalidOid)
                elog(ERROR, "no >= operator for opclass %u", opclass);
-       cmpargs = makeList2(vardata->var, prefixcon);
+       cmpargs = list_make2(vardata->var, prefixcon);
        /* Assume scalargtsel is appropriate for all supported types */
        prefixsel = DatumGetFloat8(DirectFunctionCall4(scalargtsel,
                                                                                                   PointerGetDatum(root),
@@ -3676,7 +3676,7 @@ prefix_selectivity(Query *root, VariableStatData *vardata,
                                                                        BTLessStrategyNumber);
                if (cmpopr == InvalidOid)
                        elog(ERROR, "no < operator for opclass %u", opclass);
-               cmpargs = makeList2(vardata->var, greaterstrcon);
+               cmpargs = list_make2(vardata->var, greaterstrcon);
                /* Assume scalarltsel is appropriate for all supported types */
                topsel = DatumGetFloat8(DirectFunctionCall4(scalarltsel,
                                                                                                        PointerGetDatum(root),
@@ -4177,7 +4177,7 @@ genericcostestimate(Query *root, RelOptInfo *rel,
         * eliminating duplicates is a bit trickier because indexQuals contains
         * RestrictInfo nodes and the indpred does not.  It is okay to pass a
         * mixed list to clauselist_selectivity, but we have to work a bit to
-        * generate a list without logical duplicates.  (We could just set_union
+        * generate a list without logical duplicates.  (We could just list_union
         * indpred and strippedQuals, but then we'd not get caching of per-qual
         * selectivity estimates.)
         */
@@ -4187,8 +4187,8 @@ genericcostestimate(Query *root, RelOptInfo *rel,
                List   *predExtraQuals;
 
                strippedQuals = get_actual_clauses(indexQuals);
-               predExtraQuals = set_difference(index->indpred, strippedQuals);
-               selectivityQuals = nconc(predExtraQuals, indexQuals);
+               predExtraQuals = list_difference(index->indpred, strippedQuals);
+               selectivityQuals = list_concat(predExtraQuals, indexQuals);
        }
        else
                selectivityQuals = indexQuals;
@@ -4253,7 +4253,7 @@ genericcostestimate(Query *root, RelOptInfo *rel,
         * inaccuracies here ...
         */
        cost_qual_eval(&index_qual_cost, indexQuals);
-       qual_op_cost = cpu_operator_cost * length(indexQuals);
+       qual_op_cost = cpu_operator_cost * list_length(indexQuals);
        qual_arg_cost = index_qual_cost.startup +
                index_qual_cost.per_tuple - qual_op_cost;
        if (qual_arg_cost < 0)          /* just in case... */
index f8f207d..dd158c0 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/tid.c,v 1.44 2004/05/26 04:41:39 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/tid.c,v 1.45 2004/05/30 23:40:36 neilc Exp $
  *
  * NOTES
  *       input routine largely stolen from boxin().
@@ -239,7 +239,7 @@ currtid_for_view(Relation viewrel, ItemPointer tid)
                        Query      *query;
                        TargetEntry *tle;
 
-                       if (length(rewrite->actions) != 1)
+                       if (list_length(rewrite->actions) != 1)
                                elog(ERROR, "only one select rule is allowed in views");
                        query = (Query *) linitial(rewrite->actions);
                        tle = get_tle_by_resno(query->targetList, tididx+1);
index 410faad..b1dc69e 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.113 2004/05/26 04:41:39 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.114 2004/05/30 23:40:36 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1648,7 +1648,7 @@ textToQualifiedNameList(text *textval, const char *caller)
        }
 
        pfree(rawname);
-       freeList(namelist);
+       list_free(namelist);
 
        return result;
 }
index 4d8190a..4221976 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.203 2004/05/26 04:41:40 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.204 2004/05/30 23:40:37 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1658,7 +1658,7 @@ RelationClearRelation(Relation relation, bool rebuild)
                pfree(relation->rd_am);
        if (relation->rd_rel)
                pfree(relation->rd_rel);
-       freeList(relation->rd_indexlist);
+       list_free(relation->rd_indexlist);
        if (relation->rd_indexcxt)
                MemoryContextDelete(relation->rd_indexcxt);
 
@@ -1922,7 +1922,7 @@ RelationCacheInvalidate(void)
                }
        }
 
-       rebuildList = nconc(rebuildFirstList, rebuildList);
+       rebuildList = list_concat(rebuildFirstList, rebuildList);
 
        /*
         * Now zap any remaining smgr cache entries.  This must happen before
@@ -1937,7 +1937,7 @@ RelationCacheInvalidate(void)
                relation = (Relation) lfirst(l);
                RelationClearRelation(relation, true);
        }
-       freeList(rebuildList);
+       list_free(rebuildList);
 }
 
 /*
@@ -2024,7 +2024,7 @@ AtEOXact_RelationCache(bool commit)
                 */
                if (relation->rd_indexvalid == 2)
                {
-                       freeList(relation->rd_indexlist);
+                       list_free(relation->rd_indexlist);
                        relation->rd_indexlist = NIL;
                        relation->rd_indexvalid = 0;
                }
@@ -2526,7 +2526,7 @@ RelationGetIndexList(Relation relation)
 
        /* Quick exit if we already computed the list. */
        if (relation->rd_indexvalid != 0)
-               return listCopy(relation->rd_indexlist);
+               return list_copy(relation->rd_indexlist);
 
        /*
         * We build the list we intend to return (in the caller's context)
@@ -2558,7 +2558,7 @@ RelationGetIndexList(Relation relation)
 
        /* Now save a copy of the completed list in the relcache entry. */
        oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
-       relation->rd_indexlist = listCopy(result);
+       relation->rd_indexlist = list_copy(result);
        relation->rd_indexvalid = 1;
        MemoryContextSwitchTo(oldcxt);
 
@@ -2619,10 +2619,10 @@ RelationSetIndexList(Relation relation, List *indexIds)
        Assert(relation->rd_isnailed == 1);
        /* Copy the list into the cache context (could fail for lack of mem) */
        oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
-       indexIds = listCopy(indexIds);
+       indexIds = list_copy(indexIds);
        MemoryContextSwitchTo(oldcxt);
        /* Okay to replace old list */
-       freeList(relation->rd_indexlist);
+       list_free(relation->rd_indexlist);
        relation->rd_indexlist = indexIds;
        relation->rd_indexvalid = 2;            /* mark list as forced */
 }
@@ -3083,7 +3083,7 @@ load_relcache_init_file(void)
        {
                RelationCacheInsert(rels[relno]);
                /* also make a list of their OIDs, for RelationIdIsInInitFile */
-               initFileRelationIds = lconso(RelationGetRelid(rels[relno]),
+               initFileRelationIds = lcons_oid(RelationGetRelid(rels[relno]),
                                                                         initFileRelationIds);
        }
 
@@ -3242,7 +3242,7 @@ write_relcache_init_file(void)
 
                /* also make a list of their OIDs, for RelationIdIsInInitFile */
                oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
-               initFileRelationIds = lconso(RelationGetRelid(rel),
+               initFileRelationIds = lcons_oid(RelationGetRelid(rel),
                                                                         initFileRelationIds);
                MemoryContextSwitchTo(oldcxt);
        }
@@ -3299,7 +3299,7 @@ write_relcache_init_file(void)
 bool
 RelationIdIsInInitFile(Oid relationId)
 {
-       return oidMember(relationId, initFileRelationIds);
+       return list_member_oid(initFileRelationIds, relationId);
 }
 
 /*
index f4b7860..68d2598 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.80 2004/01/19 02:06:41 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.81 2004/05/30 23:40:37 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1794,10 +1794,10 @@ get_fn_expr_argtype(FmgrInfo *flinfo, int argnum)
        else
                return InvalidOid;
 
-       if (argnum < 0 || argnum >= length(args))
+       if (argnum < 0 || argnum >= list_length(args))
                return InvalidOid;
 
-       argtype = exprType((Node *) nth(argnum, args));
+       argtype = exprType((Node *) list_nth(args, argnum));
 
        /*
         * special hack for ScalarArrayOpExpr: what the underlying function
index 6507891..6f9ff5a 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/init/miscinit.c,v 1.125 2004/05/26 04:41:43 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/init/miscinit.c,v 1.126 2004/05/30 23:40:38 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -896,7 +896,7 @@ process_preload_libraries(char *preload_libraries_string)
        {
                /* syntax error in list */
                pfree(rawstring);
-               freeList(elemlist);
+               list_free(elemlist);
                ereport(LOG,
                                (errcode(ERRCODE_SYNTAX_ERROR),
                                 errmsg("invalid list syntax for parameter \"preload_libraries\"")));
@@ -957,5 +957,5 @@ process_preload_libraries(char *preload_libraries_string)
        }
 
        pfree(rawstring);
-       freeList(elemlist);
+       list_free(elemlist);
 }
index eda37c1..8f1e708 100644 (file)
@@ -10,7 +10,7 @@
  * Written by Peter Eisentraut <peter_e@gmx.net>.
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.209 2004/05/29 22:48:21 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.210 2004/05/30 23:40:38 neilc Exp $
  *
  *--------------------------------------------------------------------
  */
@@ -4761,7 +4761,7 @@ assign_log_destination(const char *value, bool doit, GucSource source)
        {
                /* syntax error in list */
                pfree(rawstring);
-               freeList(elemlist);
+               list_free(elemlist);
                if (source >= PGC_S_INTERACTIVE)
                        ereport(ERROR,
                                        (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
@@ -4790,13 +4790,13 @@ assign_log_destination(const char *value, bool doit, GucSource source)
                                                 errmsg("unrecognised \"log_destination\" key word: \"%s\"",
                                                                tok)));
                        pfree(rawstring);
-                       freeList(elemlist);
+                       list_free(elemlist);
                        return NULL;
                }
        }
 
        pfree(rawstring);
-       freeList(elemlist);
+       list_free(elemlist);
 
        /* If we aren't going to do the assignment, just return OK indicator. */
        if (!doit)
index f6b7248..f77125c 100644 (file)
@@ -12,7 +12,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.64 2004/02/03 17:34:03 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.65 2004/05/30 23:40:39 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -245,7 +245,7 @@ PortalDefineQuery(Portal portal,
        AssertArg(PortalIsValid(portal));
        AssertState(portal->queryContext == NULL);      /* else defined already */
 
-       Assert(length(parseTrees) == length(planTrees));
+       Assert(list_length(parseTrees) == list_length(planTrees));
 
        Assert(commandTag != NULL || parseTrees == NIL);
 
index 08a11ef..9394f22 100644 (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/pg_list.h,v 1.45 2004/05/26 19:30:17 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/pg_list.h,v 1.46 2004/05/30 23:40:39 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "nodes/nodes.h"
 
 /*
- * As a temporary measure, enable the compatibility API unless the
- * include site specifically disabled it. Once the rest of the source
- * tree has been converted to the new API, this will be removed.
- */
-#ifndef DISABLE_LIST_COMPAT
-#define ENABLE_LIST_COMPAT
-#endif
-
-/*
  * This package implements singly-linked homogeneous lists. It is
  * important to have constant-time length, append, and prepend
  * operations. To achieve this, we deal with two distinct data
  */
 
 typedef struct ListCell ListCell;
-typedef struct List List;
 
-struct List
+typedef struct List
 {
        NodeTag          type;  /* T_List, T_IntList, or T_OidList */
        int                      length;
-       ListCell *head;
-       ListCell *tail;
-};
+       ListCell        *head;
+       ListCell        *tail;
+} List;
 
 struct ListCell
 {
@@ -132,6 +122,10 @@ extern int list_length(List *l);
 #define linitial_int(l)                        lfirst_int(list_head(l))
 #define linitial_oid(l)                        lfirst_oid(list_head(l))
 
+#define llast(l)                               lfirst(list_tail(l))
+#define llast_int(l)                   lfirst_int(list_tail(l))
+#define llast_oid(l)                   lfirst_oid(list_tail(l))
+
 #define lsecond(l)                             lfirst(lnext(list_head(l)))
 #define lsecond_int(l)                 lfirst_int(lnext(list_head(l)))
 #define lsecond_oid(l)                 lfirst_oid(lnext(list_head(l)))
@@ -183,7 +177,7 @@ extern int list_length(List *l);
  *    simultaneously. This macro loops through both lists at the same
  *    time, stopping when either list runs out of elements. Depending
  *    on the requirements of the call site, it may also be wise to
- *    ensure that the lengths of the two lists are equal.
+ *    assert that the lengths of the two lists are equal.
  */
 #define forboth(cell1, list1, cell2, list2)                                                    \
        for ((cell1) = list_head(list1), (cell2) = list_head(list2);    \
@@ -249,8 +243,6 @@ extern List *list_copy_tail(List *list, int nskip);
 #define lfirsti(lc)                                    lfirst_int(lc)
 #define lfirsto(lc)                                    lfirst_oid(lc)
 
-#define llast(l)                                       lfirst(list_tail(l))
-
 #define makeList1(x1)                          list_make1(x1)
 #define makeList2(x1, x2)                      list_make2(x1, x2)
 #define makeList3(x1, x2, x3)          list_make3(x1, x2, x3)
@@ -307,21 +299,13 @@ extern List *list_copy_tail(List *list, int nskip);
 
 extern int length(List *list);
 
-#endif
+#endif /* ENABLE_LIST_COMPAT */
 
-/*
- * Temporary hack: we define the FastList type whether the
- * compatibility API is enabled or not, since this allows files that
- * don't use the compatibility API to include headers that reference
- * the FastList type without an error.
- */
 typedef struct FastList
 {
        List            *list;
 } FastList;
 
-#ifdef ENABLE_LIST_COMPAT
-
 extern void FastListInit(FastList *fl);
 extern void FastListFromList(FastList *fl, List *list);
 extern List *FastListValue(FastList *fl);
@@ -332,6 +316,4 @@ extern void FastAppendo(FastList *fl, Oid datum);
 extern void FastConc(FastList *fl, List *cells);
 extern void FastConcFast(FastList *fl1, FastList *fl2);
 
-#endif
-
 #endif   /* PG_LIST_H */
index d5819ea..5db0019 100644 (file)
@@ -10,7 +10,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/primnodes.h,v 1.98 2004/05/10 22:44:49 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.99 2004/05/30 23:40:39 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -42,8 +42,8 @@
  * transforms INSERT/UPDATE tlists into a normalized form with exactly
  * one entry for each column of the destination table.  Before that's
  * happened, however, it is risky to assume that resno == position.
- * Generally get_tle_by_resno() should be used rather than nth() to fetch
- * tlist entries by resno.
+ * Generally get_tle_by_resno() should be used rather than list_nth()
+ * to fetch tlist entries by resno.
  *
  * resname is required to represent the correct column name in non-resjunk
  * entries of top-level SELECT targetlists, since it will be used as the
index 7656521..d18e1e6 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.284 2004/05/26 13:57:04 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.285 2004/05/30 23:40:40 neilc Exp $ */
 
 /* Copyright comment */
 %{
@@ -4093,7 +4093,7 @@ file_name:                                StringConst             { $$ = $1; };
 /* func_name will soon return a List ... but not yet */
 /*
 func_name: function_name
-                       { $$ = makeList1(makeString($1)); }
+                       { $$ = list_make1(makeString($1)); }
                | dotted_name
                        { $$ = $1; }
                ;
index b9bb7f6..7fa1eec 100644 (file)
@@ -3,7 +3,7 @@
  *                       procedural language
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.101 2004/05/26 04:41:48 neilc Exp $
+ *       $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.102 2004/05/30 23:40:41 neilc Exp $
  *
  *       This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -3835,7 +3835,7 @@ exec_simple_check_plan(PLpgSQL_expr * expr)
         * 1. We can only evaluate queries that resulted in one single
         * execution plan
         */
-       if (length(spi_plan->ptlist) != 1)
+       if (list_length(spi_plan->ptlist) != 1)
                return;
 
        plan = (Plan *) linitial(spi_plan->ptlist);
@@ -3862,7 +3862,7 @@ exec_simple_check_plan(PLpgSQL_expr * expr)
        /*
         * 4. The plan must have a single attribute as result
         */
-       if (length(plan->targetlist) != 1)
+       if (list_length(plan->targetlist) != 1)
                return;
 
        tle = (TargetEntry *) linitial(plan->targetlist);
index d30d3cd..7d9336e 100644 (file)
@@ -31,7 +31,7 @@
  *       ENHANCEMENTS, OR MODIFICATIONS.
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.84 2004/05/26 04:41:50 neilc Exp $
+ *       $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.85 2004/05/30 23:40:41 neilc Exp $
  *
  **********************************************************************/
 
@@ -1868,9 +1868,9 @@ pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
                qdesc->argtypelems[i] = ((Form_pg_type) GETSTRUCT(typeTup))->typelem;
                ReleaseSysCache(typeTup);
 
-               freeList(typename->names);
+               list_free(typename->names);
                pfree(typename);
-               freeList(names);
+               list_free(names);
                pfree(argcopy);
        }