errmsg("must specify relation and object name")));
/* Extract relation name and open relation. */
- relname = list_truncate(list_copy(object), nnames - 1);
+ relname = list_copy_head(object, nnames - 1);
relation = table_openrv_extended(makeRangeVarFromNameList(relname),
AccessShareLock,
missing_ok);
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("column name must be qualified")));
attname = strVal(llast(object));
- relname = list_truncate(list_copy(object), list_length(object) - 1);
+ relname = list_copy_head(object, list_length(object) - 1);
/* XXX no missing_ok support here */
relation = relation_openrv(makeRangeVarFromNameList(relname), lockmode);
reloid = RelationGetRelid(relation);
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("column name must be qualified")));
attname = strVal(llast(object));
- relname = list_truncate(list_copy(object), list_length(object) - 1);
+ relname = list_copy_head(object, list_length(object) - 1);
/* XXX no missing_ok support here */
relation = relation_openrv(makeRangeVarFromNameList(relname), lockmode);
reloid = RelationGetRelid(relation);
* address. The rest can be used directly by get_object_address_opcf().
*/
membernum = atoi(strVal(llast(linitial(object))));
- copy = list_truncate(list_copy(linitial(object)), list_length(linitial(object)) - 1);
+ copy = list_copy_head(linitial(object), list_length(linitial(object)) - 1);
/* no missing_ok support here */
famaddr = get_object_address_opcf(OBJECT_OPFAMILY, copy, false);
List *parent_object;
RangeVar *parent_rel;
- parent_object = list_truncate(list_copy(object),
- list_length(object) - 1);
+ parent_object = list_copy_head(object, list_length(object) - 1);
if (schema_does_not_exist_skipping(parent_object, msg, name))
return true;
{
msg = gettext_noop("trigger \"%s\" for relation \"%s\" does not exist, skipping");
name = strVal(llast(castNode(List, object)));
- args = NameListToString(list_truncate(list_copy(castNode(List, object)),
- list_length(castNode(List, object)) - 1));
+ args = NameListToString(list_copy_head(castNode(List, object),
+ list_length(castNode(List, object)) - 1));
}
break;
case OBJECT_POLICY:
{
msg = gettext_noop("policy \"%s\" for relation \"%s\" does not exist, skipping");
name = strVal(llast(castNode(List, object)));
- args = NameListToString(list_truncate(list_copy(castNode(List, object)),
- list_length(castNode(List, object)) - 1));
+ args = NameListToString(list_copy_head(castNode(List, object),
+ list_length(castNode(List, object)) - 1));
}
break;
case OBJECT_EVENT_TRIGGER:
{
msg = gettext_noop("rule \"%s\" for relation \"%s\" does not exist, skipping");
name = strVal(llast(castNode(List, object)));
- args = NameListToString(list_truncate(list_copy(castNode(List, object)),
- list_length(castNode(List, object)) - 1));
+ args = NameListToString(list_copy_head(castNode(List, object),
+ list_length(castNode(List, object)) - 1));
}
break;
case OBJECT_FDW:
RangeVar *rel;
/* Separate relname and attr name */
- relname = list_truncate(list_copy(owned_by), nnames - 1);
+ relname = list_copy_head(owned_by, nnames - 1);
attrname = strVal(llast(owned_by));
/* Open and lock rel to ensure it won't go away meanwhile */
*subpaths = list_concat(*subpaths,
list_copy_tail(apath->subpaths,
apath->first_partial_path));
- new_special_subpaths =
- list_truncate(list_copy(apath->subpaths),
- apath->first_partial_path);
+ new_special_subpaths = list_copy_head(apath->subpaths,
+ apath->first_partial_path);
*special_subpaths = list_concat(*special_subpaths,
new_special_subpaths);
return;
root->query_pathkeys);
else if (npathkeys > 0)
useful_pathkeys_list = lappend(useful_pathkeys_list,
- list_truncate(list_copy(root->query_pathkeys),
- npathkeys));
+ list_copy_head(root->query_pathkeys,
+ npathkeys));
}
return useful_pathkeys_list;
rc->rctype = (RowCompareType) op_strategy;
rc->opnos = new_ops;
- rc->opfamilies = list_truncate(list_copy(clause->opfamilies),
- matching_cols);
- rc->inputcollids = list_truncate(list_copy(clause->inputcollids),
- matching_cols);
- rc->largs = list_truncate(copyObject(var_args),
- matching_cols);
- rc->rargs = list_truncate(copyObject(non_var_args),
- matching_cols);
+ rc->opfamilies = list_copy_head(clause->opfamilies,
+ matching_cols);
+ rc->inputcollids = list_copy_head(clause->inputcollids,
+ matching_cols);
+ rc->largs = list_copy_head(var_args, matching_cols);
+ rc->rargs = list_copy_head(non_var_args, matching_cols);
iclause->indexquals = list_make1(make_simple_restrictinfo(root,
(Expr *) rc));
}
else if (nuseful == list_length(pathkeys))
return pathkeys;
else
- return list_truncate(list_copy(pathkeys), nuseful);
+ return list_copy_head(pathkeys, nuseful);
}
/*
*/
if (tlist_was_changed && (flags & (CP_EXACT_TLIST | CP_SMALL_TLIST)))
{
- tlist = list_truncate(list_copy(plan->plan.targetlist),
- orig_tlist_length);
+ tlist = list_copy_head(plan->plan.targetlist, orig_tlist_length);
return inject_projection_plan((Plan *) plan, tlist,
plan->plan.parallel_safe);
}
*/
if (tlist_was_changed && (flags & (CP_EXACT_TLIST | CP_SMALL_TLIST)))
{
- tlist = list_truncate(list_copy(plan->targetlist), orig_tlist_length);
+ tlist = list_copy_head(plan->targetlist, orig_tlist_length);
return inject_projection_plan(plan, tlist, plan->parallel_safe);
}
else