summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt')
-rw-r--r--src/backend/utils/adt/name.c4
-rw-r--r--src/backend/utils/adt/not_in.c6
-rw-r--r--src/backend/utils/adt/regproc.c8
-rw-r--r--src/backend/utils/adt/ri_triggers.c4
-rw-r--r--src/backend/utils/adt/ruleutils.c44
-rw-r--r--src/backend/utils/adt/selfuncs.c32
-rw-r--r--src/backend/utils/adt/tid.c4
-rw-r--r--src/backend/utils/adt/varlena.c4
8 files changed, 53 insertions, 53 deletions
diff --git a/src/backend/utils/adt/name.c b/src/backend/utils/adt/name.c
index bb34667c4d..ecac8d2d50 100644
--- a/src/backend/utils/adt/name.c
+++ b/src/backend/utils/adt/name.c
@@ -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)
{
diff --git a/src/backend/utils/adt/not_in.c b/src/backend/utils/adt/not_in.c
index 8222e33bde..e3fb57d5fc 100644
--- a/src/backend/utils/adt/not_in.c
+++ b/src/backend/utils/adt/not_in.c
@@ -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 */
diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c
index 9c688401ec..cd4f1fee1e 100644
--- a/src/backend/utils/adt/regproc.c
+++ b/src/backend/utils/adt/regproc.c
@@ -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;
}
diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c
index 9e3a06cd82..253323c0b0 100644
--- a/src/backend/utils/adt/ri_triggers.c
+++ b/src/backend/utils/adt/ri_triggers.c
@@ -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;
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 0356b183fc..8614e73d53 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -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)));
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index cd9a6444d4..75eb0d2a52 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -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... */
diff --git a/src/backend/utils/adt/tid.c b/src/backend/utils/adt/tid.c
index f8f207d72a..dd158c04cb 100644
--- a/src/backend/utils/adt/tid.c
+++ b/src/backend/utils/adt/tid.c
@@ -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);
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 410faad692..b1dc69ee90 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -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;
}