Use the new List API function names throughout the backend, and disable the
list compatibility API by default. While doing this, I decided to keep the llast() macro around and introduce llast_int() and llast_oid() variants.
This commit is contained in:
parent
ec0b1f2716
commit
72b6ad6313
|
@ -779,10 +779,10 @@ findFunc(char *fname)
|
||||||
FuncCandidateList clist,
|
FuncCandidateList clist,
|
||||||
ptr;
|
ptr;
|
||||||
Oid funcid = InvalidOid;
|
Oid funcid = InvalidOid;
|
||||||
List *names = makeList1(makeString(fname));
|
List *names = list_make1(makeString(fname));
|
||||||
|
|
||||||
ptr = clist = FuncnameGetCandidates(names, 1);
|
ptr = clist = FuncnameGetCandidates(names, 1);
|
||||||
freeList(names);
|
list_free(names);
|
||||||
|
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
return funcid;
|
return funcid;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* NOTES
|
||||||
* some of the executor utility code such as "ExecTypeFromTL" should be
|
* some of the executor utility code such as "ExecTypeFromTL" should be
|
||||||
|
@ -484,7 +484,7 @@ BuildDescForRelation(List *schema)
|
||||||
/*
|
/*
|
||||||
* allocate a new tuple descriptor
|
* allocate a new tuple descriptor
|
||||||
*/
|
*/
|
||||||
natts = length(schema);
|
natts = list_length(schema);
|
||||||
desc = CreateTemplateTupleDesc(natts, false);
|
desc = CreateTemplateTupleDesc(natts, false);
|
||||||
constr->has_not_null = false;
|
constr->has_not_null = false;
|
||||||
|
|
||||||
|
@ -503,7 +503,7 @@ BuildDescForRelation(List *schema)
|
||||||
|
|
||||||
attname = entry->colname;
|
attname = entry->colname;
|
||||||
atttypmod = entry->typename->typmod;
|
atttypmod = entry->typename->typmod;
|
||||||
attdim = length(entry->typename->arrayBounds);
|
attdim = list_length(entry->typename->arrayBounds);
|
||||||
|
|
||||||
if (entry->typename->setof)
|
if (entry->typename->setof)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
|
@ -624,7 +624,7 @@ TypeGetTupleDesc(Oid typeoid, List *colaliases)
|
||||||
int varattno;
|
int varattno;
|
||||||
|
|
||||||
/* does the list length match the number of attributes? */
|
/* does the list length match the number of attributes? */
|
||||||
if (length(colaliases) != natts)
|
if (list_length(colaliases) != natts)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
||||||
errmsg("number of aliases does not match number of columns")));
|
errmsg("number of aliases does not match number of columns")));
|
||||||
|
@ -632,7 +632,7 @@ TypeGetTupleDesc(Oid typeoid, List *colaliases)
|
||||||
/* OK, use the aliases instead */
|
/* OK, use the aliases instead */
|
||||||
for (varattno = 0; varattno < natts; varattno++)
|
for (varattno = 0; varattno < natts; varattno++)
|
||||||
{
|
{
|
||||||
char *label = strVal(nth(varattno, colaliases));
|
char *label = strVal(list_nth(colaliases, varattno));
|
||||||
|
|
||||||
if (label != NULL)
|
if (label != NULL)
|
||||||
namestrcpy(&(tupdesc->attrs[varattno]->attname), label);
|
namestrcpy(&(tupdesc->attrs[varattno]->attname), label);
|
||||||
|
@ -655,7 +655,7 @@ TypeGetTupleDesc(Oid typeoid, List *colaliases)
|
||||||
errmsg("no column alias was provided")));
|
errmsg("no column alias was provided")));
|
||||||
|
|
||||||
/* the alias list length must be 1 */
|
/* the alias list length must be 1 */
|
||||||
if (length(colaliases) != 1)
|
if (list_length(colaliases) != 1)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
||||||
errmsg("number of aliases does not match number of columns")));
|
errmsg("number of aliases does not match number of columns")));
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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)
|
if (is_root != split->is_root)
|
||||||
elog(LOG, "forget_matching_split: fishy is_root data");
|
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 */
|
break; /* need not look further */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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;
|
ResultRelInfo *resultRelInfo;
|
||||||
ListCell *l;
|
ListCell *l;
|
||||||
|
|
||||||
numResultRelations = length(resultRelations);
|
numResultRelations = list_length(resultRelations);
|
||||||
resultRelInfos = (ResultRelInfo *)
|
resultRelInfos = (ResultRelInfo *)
|
||||||
palloc(numResultRelations * sizeof(ResultRelInfo));
|
palloc(numResultRelations * sizeof(ResultRelInfo));
|
||||||
resultRelInfo = resultRelInfos;
|
resultRelInfo = resultRelInfos;
|
||||||
|
@ -590,7 +590,7 @@ InitPlan(QueryDesc *queryDesc, bool explainOnly)
|
||||||
|
|
||||||
foreach(l, parseTree->rowMarks)
|
foreach(l, parseTree->rowMarks)
|
||||||
{
|
{
|
||||||
Index rti = lfirsti(l);
|
Index rti = lfirst_int(l);
|
||||||
Oid relid = getrelid(rti, rangeTable);
|
Oid relid = getrelid(rti, rangeTable);
|
||||||
Relation relation;
|
Relation relation;
|
||||||
execRowMark *erm;
|
execRowMark *erm;
|
||||||
|
@ -614,7 +614,7 @@ InitPlan(QueryDesc *queryDesc, bool explainOnly)
|
||||||
int nSlots = ExecCountSlotsNode(plan);
|
int nSlots = ExecCountSlotsNode(plan);
|
||||||
|
|
||||||
if (parseTree->resultRelations != NIL)
|
if (parseTree->resultRelations != NIL)
|
||||||
nSlots += length(parseTree->resultRelations);
|
nSlots += list_length(parseTree->resultRelations);
|
||||||
else
|
else
|
||||||
nSlots += 1;
|
nSlots += 1;
|
||||||
estate->es_tupleTable = ExecCreateTupleTable(nSlots);
|
estate->es_tupleTable = ExecCreateTupleTable(nSlots);
|
||||||
|
@ -2067,7 +2067,7 @@ EvalPlanQualStart(evalPlanQual *epq, EState *estate, evalPlanQual *priorepq)
|
||||||
int rtsize;
|
int rtsize;
|
||||||
MemoryContext oldcontext;
|
MemoryContext oldcontext;
|
||||||
|
|
||||||
rtsize = length(estate->es_range_table);
|
rtsize = list_length(estate->es_range_table);
|
||||||
|
|
||||||
epq->estate = epqstate = CreateExecutorState();
|
epq->estate = epqstate = CreateExecutorState();
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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));
|
aclcheck_error(aclresult, ACL_KIND_PROC, get_func_name(foid));
|
||||||
|
|
||||||
/* Safety check (should never fail, as parser should check sooner) */
|
/* 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");
|
elog(ERROR, "too many arguments");
|
||||||
|
|
||||||
/* Set up the primary fmgr lookup information */
|
/* Set up the primary fmgr lookup information */
|
||||||
|
@ -1958,7 +1958,7 @@ ExecEvalArray(ArrayExprState *astate, ExprContext *econtext,
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
ndims = 1;
|
ndims = 1;
|
||||||
nelems = length(astate->elements);
|
nelems = list_length(astate->elements);
|
||||||
|
|
||||||
/* Shouldn't happen here, but if length is 0, return NULL */
|
/* Shouldn't happen here, but if length is 0, return NULL */
|
||||||
if (nelems == 0)
|
if (nelems == 0)
|
||||||
|
@ -1999,7 +1999,7 @@ ExecEvalArray(ArrayExprState *astate, ExprContext *econtext,
|
||||||
char *dat = NULL;
|
char *dat = NULL;
|
||||||
Size ndatabytes = 0;
|
Size ndatabytes = 0;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
int outer_nelems = length(astate->elements);
|
int outer_nelems = list_length(astate->elements);
|
||||||
int elem_ndims = 0;
|
int elem_ndims = 0;
|
||||||
int *elem_dims = NULL;
|
int *elem_dims = NULL;
|
||||||
int *elem_lbs = NULL;
|
int *elem_lbs = NULL;
|
||||||
|
@ -2128,7 +2128,7 @@ ExecEvalRow(RowExprState *rstate,
|
||||||
*isDone = ExprSingleResult;
|
*isDone = ExprSingleResult;
|
||||||
|
|
||||||
/* Allocate workspace */
|
/* Allocate workspace */
|
||||||
nargs = length(rstate->args);
|
nargs = list_length(rstate->args);
|
||||||
if (nargs == 0) /* avoid palloc(0) if no fields */
|
if (nargs == 0) /* avoid palloc(0) if no fields */
|
||||||
nargs = 1;
|
nargs = 1;
|
||||||
values = (Datum *) palloc(nargs * sizeof(Datum));
|
values = (Datum *) palloc(nargs * sizeof(Datum));
|
||||||
|
@ -3170,7 +3170,7 @@ int
|
||||||
ExecTargetListLength(List *targetlist)
|
ExecTargetListLength(List *targetlist)
|
||||||
{
|
{
|
||||||
/* This used to be more complex, but fjoins are dead */
|
/* This used to be more complex, but fjoins are dead */
|
||||||
return length(targetlist);
|
return list_length(targetlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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;
|
int cur_resno = 1;
|
||||||
char fldname[NAMEDATALEN];
|
char fldname[NAMEDATALEN];
|
||||||
|
|
||||||
typeInfo = CreateTemplateTupleDesc(length(exprList), false);
|
typeInfo = CreateTemplateTupleDesc(list_length(exprList), false);
|
||||||
|
|
||||||
foreach(l, exprList)
|
foreach(l, exprList)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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)
|
while (estate->es_exprcontexts)
|
||||||
{
|
{
|
||||||
/* XXX: seems there ought to be a faster way to implement this
|
/* 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((ExprContext *) linitial(estate->es_exprcontexts));
|
||||||
/* FreeExprContext removed the list link for us */
|
/* FreeExprContext removed the list link for us */
|
||||||
|
@ -355,7 +355,7 @@ FreeExprContext(ExprContext *econtext)
|
||||||
MemoryContextDelete(econtext->ecxt_per_tuple_memory);
|
MemoryContextDelete(econtext->ecxt_per_tuple_memory);
|
||||||
/* Unlink self from owning EState */
|
/* Unlink self from owning EState */
|
||||||
estate = econtext->ecxt_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 */
|
/* And delete the ExprContext node */
|
||||||
pfree(econtext);
|
pfree(econtext);
|
||||||
}
|
}
|
||||||
|
@ -656,7 +656,7 @@ ExecOpenIndices(ResultRelInfo *resultRelInfo)
|
||||||
* Get cached list of index OIDs
|
* Get cached list of index OIDs
|
||||||
*/
|
*/
|
||||||
indexoidlist = RelationGetIndexList(resultRelation);
|
indexoidlist = RelationGetIndexList(resultRelation);
|
||||||
len = length(indexoidlist);
|
len = list_length(indexoidlist);
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -676,7 +676,7 @@ ExecOpenIndices(ResultRelInfo *resultRelInfo)
|
||||||
i = 0;
|
i = 0;
|
||||||
foreach(l, indexoidlist)
|
foreach(l, indexoidlist)
|
||||||
{
|
{
|
||||||
Oid indexOid = lfirsto(l);
|
Oid indexOid = lfirst_oid(l);
|
||||||
Relation indexDesc;
|
Relation indexDesc;
|
||||||
IndexInfo *ii;
|
IndexInfo *ii;
|
||||||
|
|
||||||
|
@ -713,7 +713,7 @@ ExecOpenIndices(ResultRelInfo *resultRelInfo)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
freeList(indexoidlist);
|
list_free(indexoidlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------
|
/* ----------------------------------------------------------------
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* get the count of aggregates in targetlist and quals
|
||||||
*/
|
*/
|
||||||
numaggs = aggstate->numaggs;
|
numaggs = aggstate->numaggs;
|
||||||
Assert(numaggs == length(aggstate->aggs));
|
Assert(numaggs == list_length(aggstate->aggs));
|
||||||
if (numaggs <= 0)
|
if (numaggs <= 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* Set up empty vector of subplan states
|
||||||
*/
|
*/
|
||||||
nplans = length(node->appendplans);
|
nplans = list_length(node->appendplans);
|
||||||
|
|
||||||
appendplanstates = (PlanState **) palloc0(nplans * sizeof(PlanState *));
|
appendplanstates = (PlanState **) palloc0(nplans * sizeof(PlanState *));
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ ExecInitAppend(Append *node, EState *estate)
|
||||||
appendstate->as_whichplan = i;
|
appendstate->as_whichplan = i;
|
||||||
exec_append_initialize_next(appendstate);
|
exec_append_initialize_next(appendstate);
|
||||||
|
|
||||||
initNode = (Plan *) nth(i, node->appendplans);
|
initNode = (Plan *) list_nth(node->appendplans, i);
|
||||||
appendplanstates[i] = ExecInitNode(initNode, estate);
|
appendplanstates[i] = ExecInitNode(initNode, estate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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.
|
* 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));
|
hashtable->hashfunctions = (FmgrInfo *) palloc(nkeys * sizeof(FmgrInfo));
|
||||||
i = 0;
|
i = 0;
|
||||||
foreach(ho, hashOperators)
|
foreach(ho, hashOperators)
|
||||||
{
|
{
|
||||||
Oid hashfn;
|
Oid hashfn;
|
||||||
|
|
||||||
hashfn = get_op_hash_function(lfirsto(ho));
|
hashfn = get_op_hash_function(lfirst_oid(ho));
|
||||||
if (!OidIsValid(hashfn))
|
if (!OidIsValid(hashfn))
|
||||||
elog(ERROR, "could not find hash function for hash operator %u",
|
elog(ERROR, "could not find hash function for hash operator %u",
|
||||||
lfirsto(ho));
|
lfirst_oid(ho));
|
||||||
fmgr_info(hashfn, &hashtable->hashfunctions[i]);
|
fmgr_info(hashfn, &hashtable->hashfunctions[i]);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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));
|
Assert(IsA(hclause, OpExpr));
|
||||||
lclauses = lappend(lclauses, linitial(fstate->args));
|
lclauses = lappend(lclauses, linitial(fstate->args));
|
||||||
rclauses = lappend(rclauses, lsecond(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_OuterHashKeys = lclauses;
|
||||||
hjstate->hj_InnerHashKeys = rclauses;
|
hjstate->hj_InnerHashKeys = rclauses;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* get the index node information
|
||||||
*/
|
*/
|
||||||
indxid_item = list_head(node->indxid);
|
indxid_item = list_head(node->indxid);
|
||||||
numIndices = length(node->indxid);
|
numIndices = list_length(node->indxid);
|
||||||
indexPtr = -1;
|
indexPtr = -1;
|
||||||
|
|
||||||
CXT1_printf("ExecInitIndexScan: context is %d\n", CurrentMemoryContext);
|
CXT1_printf("ExecInitIndexScan: context is %d\n", CurrentMemoryContext);
|
||||||
|
@ -772,7 +772,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
|
||||||
indxsubtype = lnext(indxsubtype);
|
indxsubtype = lnext(indxsubtype);
|
||||||
lossyflags = (List *) lfirst(indxlossy);
|
lossyflags = (List *) lfirst(indxlossy);
|
||||||
indxlossy = lnext(indxlossy);
|
indxlossy = lnext(indxlossy);
|
||||||
n_keys = length(quals);
|
n_keys = list_length(quals);
|
||||||
scan_keys = (n_keys <= 0) ? NULL :
|
scan_keys = (n_keys <= 0) ? NULL :
|
||||||
(ScanKey) palloc(n_keys * sizeof(ScanKeyData));
|
(ScanKey) palloc(n_keys * sizeof(ScanKeyData));
|
||||||
run_keys = (n_keys <= 0) ? NULL :
|
run_keys = (n_keys <= 0) ? NULL :
|
||||||
|
@ -804,11 +804,11 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
|
||||||
*/
|
*/
|
||||||
clause = (OpExpr *) lfirst(qual_cell);
|
clause = (OpExpr *) lfirst(qual_cell);
|
||||||
qual_cell = lnext(qual_cell);
|
qual_cell = lnext(qual_cell);
|
||||||
strategy = lfirsti(strategy_cell);
|
strategy = lfirst_int(strategy_cell);
|
||||||
strategy_cell = lnext(strategy_cell);
|
strategy_cell = lnext(strategy_cell);
|
||||||
subtype = lfirsto(subtype_cell);
|
subtype = lfirst_oid(subtype_cell);
|
||||||
subtype_cell = lnext(subtype_cell);
|
subtype_cell = lnext(subtype_cell);
|
||||||
lossy = lfirsti(lossyflag_cell);
|
lossy = lfirst_int(lossyflag_cell);
|
||||||
lossyflag_cell = lnext(lossyflag_cell);
|
lossyflag_cell = lnext(lossyflag_cell);
|
||||||
|
|
||||||
if (!IsA(clause, OpExpr))
|
if (!IsA(clause, OpExpr))
|
||||||
|
@ -892,17 +892,18 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
|
||||||
scanvalue); /* constant */
|
scanvalue); /* constant */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this operator is lossy, add its indxqualorig expression
|
* If this operator is lossy, add its indxqualorig
|
||||||
* to the list of quals to recheck. The nth() calls here could
|
* expression to the list of quals to recheck. The
|
||||||
* be avoided by chasing the lists in parallel to all the other
|
* list_nth() calls here could be avoided by chasing the
|
||||||
* lists, but since lossy operators are very uncommon, it's
|
* lists in parallel to all the other lists, but since
|
||||||
* probably a waste of time to do so.
|
* lossy operators are very uncommon, it's probably a
|
||||||
|
* waste of time to do so.
|
||||||
*/
|
*/
|
||||||
if (lossy)
|
if (lossy)
|
||||||
{
|
{
|
||||||
|
List *qualOrig = indexstate->indxqualorig;
|
||||||
lossyQuals[i] = lappend(lossyQuals[i],
|
lossyQuals[i] = lappend(lossyQuals[i],
|
||||||
nth(j,
|
list_nth((List *) list_nth(qualOrig, i), j));
|
||||||
(List *) nth(i, indexstate->indxqualorig)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -980,7 +981,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < numIndices; i++)
|
for (i = 0; i < numIndices; i++)
|
||||||
{
|
{
|
||||||
Oid indexOid = lfirsto(indxid_item);
|
Oid indexOid = lfirst_oid(indxid_item);
|
||||||
|
|
||||||
indexDescs[i] = index_open(indexOid);
|
indexDescs[i] = index_open(indexOid);
|
||||||
scanDescs[i] = index_beginscan(currentRelation,
|
scanDescs[i] = index_beginscan(currentRelation,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* 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)
|
forboth(clause, compareQual, eqclause, eqQual)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* calculation we have to do is done in the parent econtext, since the
|
||||||
* Param values don't need to have per-query lifetime.)
|
* 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)
|
forboth(l, subplan->parParam, pvar, node->args)
|
||||||
{
|
{
|
||||||
|
@ -341,7 +341,7 @@ ExecScanSubPlan(SubPlanState *node,
|
||||||
* For ALL, ANY, and MULTIEXPR sublinks, iterate over combining
|
* For ALL, ANY, and MULTIEXPR sublinks, iterate over combining
|
||||||
* operators for columns of tuple.
|
* 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)
|
forboth(l, node->exprs, plst, subplan->paramIds)
|
||||||
{
|
{
|
||||||
|
@ -469,7 +469,7 @@ buildSubPlanHash(SubPlanState *node)
|
||||||
{
|
{
|
||||||
SubPlan *subplan = (SubPlan *) node->xprstate.expr;
|
SubPlan *subplan = (SubPlan *) node->xprstate.expr;
|
||||||
PlanState *planstate = node->planstate;
|
PlanState *planstate = node->planstate;
|
||||||
int ncols = length(node->exprs);
|
int ncols = list_length(node->exprs);
|
||||||
ExprContext *innerecontext = node->innerecontext;
|
ExprContext *innerecontext = node->innerecontext;
|
||||||
MemoryContext tempcxt = innerecontext->ecxt_per_tuple_memory;
|
MemoryContext tempcxt = innerecontext->ecxt_per_tuple_memory;
|
||||||
MemoryContext oldcontext;
|
MemoryContext oldcontext;
|
||||||
|
@ -566,7 +566,7 @@ buildSubPlanHash(SubPlanState *node)
|
||||||
*/
|
*/
|
||||||
foreach(plst, subplan->paramIds)
|
foreach(plst, subplan->paramIds)
|
||||||
{
|
{
|
||||||
int paramid = lfirsti(plst);
|
int paramid = lfirst_int(plst);
|
||||||
ParamExecData *prmdata;
|
ParamExecData *prmdata;
|
||||||
|
|
||||||
prmdata = &(innerecontext->ecxt_param_exec_vals[paramid]);
|
prmdata = &(innerecontext->ecxt_param_exec_vals[paramid]);
|
||||||
|
@ -739,7 +739,7 @@ ExecInitSubPlan(SubPlanState *node, EState *estate)
|
||||||
|
|
||||||
foreach(lst, subplan->setParam)
|
foreach(lst, subplan->setParam)
|
||||||
{
|
{
|
||||||
int paramid = lfirsti(lst);
|
int paramid = lfirst_int(lst);
|
||||||
ParamExecData *prm = &(estate->es_param_exec_vals[paramid]);
|
ParamExecData *prm = &(estate->es_param_exec_vals[paramid]);
|
||||||
|
|
||||||
prm->execPlan = node;
|
prm->execPlan = node;
|
||||||
|
@ -773,7 +773,7 @@ ExecInitSubPlan(SubPlanState *node, EState *estate)
|
||||||
/* and a short-lived exprcontext for function evaluation */
|
/* and a short-lived exprcontext for function evaluation */
|
||||||
node->innerecontext = CreateExprContext(estate);
|
node->innerecontext = CreateExprContext(estate);
|
||||||
/* Silly little array of column numbers 1..n */
|
/* Silly little array of column numbers 1..n */
|
||||||
ncols = length(node->exprs);
|
ncols = list_length(node->exprs);
|
||||||
node->keyColIdx = (AttrNumber *) palloc(ncols * sizeof(AttrNumber));
|
node->keyColIdx = (AttrNumber *) palloc(ncols * sizeof(AttrNumber));
|
||||||
for (i = 0; i < ncols; i++)
|
for (i = 0; i < ncols; i++)
|
||||||
node->keyColIdx[i] = i + 1;
|
node->keyColIdx[i] = i + 1;
|
||||||
|
@ -810,7 +810,7 @@ ExecInitSubPlan(SubPlanState *node, EState *estate)
|
||||||
|
|
||||||
Assert(IsA(fstate, FuncExprState));
|
Assert(IsA(fstate, FuncExprState));
|
||||||
Assert(IsA(opexpr, OpExpr));
|
Assert(IsA(opexpr, OpExpr));
|
||||||
Assert(length(fstate->args) == 2);
|
Assert(list_length(fstate->args) == 2);
|
||||||
|
|
||||||
/* Process lefthand argument */
|
/* Process lefthand argument */
|
||||||
exstate = (ExprState *) linitial(fstate->args);
|
exstate = (ExprState *) linitial(fstate->args);
|
||||||
|
@ -992,7 +992,7 @@ ExecSetParamPlan(SubPlanState *node, ExprContext *econtext)
|
||||||
*/
|
*/
|
||||||
foreach(l, subplan->setParam)
|
foreach(l, subplan->setParam)
|
||||||
{
|
{
|
||||||
int paramid = lfirsti(l);
|
int paramid = lfirst_int(l);
|
||||||
ParamExecData *prm = &(econtext->ecxt_param_exec_vals[paramid]);
|
ParamExecData *prm = &(econtext->ecxt_param_exec_vals[paramid]);
|
||||||
|
|
||||||
prm->execPlan = NULL;
|
prm->execPlan = NULL;
|
||||||
|
@ -1017,7 +1017,7 @@ ExecSetParamPlan(SubPlanState *node, ExprContext *econtext)
|
||||||
{
|
{
|
||||||
foreach(l, subplan->setParam)
|
foreach(l, subplan->setParam)
|
||||||
{
|
{
|
||||||
int paramid = lfirsti(l);
|
int paramid = lfirst_int(l);
|
||||||
ParamExecData *prm = &(econtext->ecxt_param_exec_vals[paramid]);
|
ParamExecData *prm = &(econtext->ecxt_param_exec_vals[paramid]);
|
||||||
|
|
||||||
prm->execPlan = NULL;
|
prm->execPlan = NULL;
|
||||||
|
@ -1091,7 +1091,7 @@ ExecReScanSetParamPlan(SubPlanState *node, PlanState *parent)
|
||||||
*/
|
*/
|
||||||
foreach(l, subplan->setParam)
|
foreach(l, subplan->setParam)
|
||||||
{
|
{
|
||||||
int paramid = lfirsti(l);
|
int paramid = lfirst_int(l);
|
||||||
ParamExecData *prm = &(estate->es_param_exec_vals[paramid]);
|
ParamExecData *prm = &(estate->es_param_exec_vals[paramid]);
|
||||||
|
|
||||||
prm->execPlan = node;
|
prm->execPlan = node;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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;
|
ListCell *l;
|
||||||
|
|
||||||
tidList = (ItemPointerData *)
|
tidList = (ItemPointerData *)
|
||||||
palloc(length(tidstate->tss_tideval) * sizeof(ItemPointerData));
|
palloc(list_length(tidstate->tss_tideval) * sizeof(ItemPointerData));
|
||||||
|
|
||||||
foreach(l, evalList)
|
foreach(l, evalList)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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;
|
int k;
|
||||||
|
|
||||||
/* Ensure that the plan contains only one regular SELECT query */
|
/* 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,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
|
(errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
|
||||||
errmsg("cannot open multi-query plan as cursor")));
|
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,
|
PortalDefineQuery(portal,
|
||||||
NULL, /* unfortunately don't have sourceText */
|
NULL, /* unfortunately don't have sourceText */
|
||||||
"SELECT", /* cursor's query is always a SELECT */
|
"SELECT", /* cursor's query is always a SELECT */
|
||||||
makeList1(queryTree),
|
list_make1(queryTree),
|
||||||
makeList1(planTree),
|
list_make1(planTree),
|
||||||
PortalGetHeapMemory(portal));
|
PortalGetHeapMemory(portal));
|
||||||
|
|
||||||
MemoryContextSwitchTo(oldcontext);
|
MemoryContextSwitchTo(oldcontext);
|
||||||
|
@ -951,7 +951,7 @@ SPI_is_cursor_plan(void *plan)
|
||||||
}
|
}
|
||||||
|
|
||||||
qtlist = spiplan->qtlist;
|
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));
|
Query *queryTree = (Query *) linitial((List *) linitial(qtlist));
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,12 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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"
|
#include "postgres.h"
|
||||||
|
|
||||||
#define DISABLE_LIST_COMPAT
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
|
@ -15,13 +15,11 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 "postgres.h"
|
||||||
|
|
||||||
#include "nodes/parsenodes.h"
|
#include "nodes/parsenodes.h"
|
||||||
|
|
|
@ -18,13 +18,11 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 "postgres.h"
|
||||||
|
|
||||||
#include "nodes/params.h"
|
#include "nodes/params.h"
|
||||||
|
|
|
@ -9,12 +9,10 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 "postgres.h"
|
||||||
#include "nodes/pg_list.h"
|
#include "nodes/pg_list.h"
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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_Expr *a = makeNode(A_Expr);
|
||||||
|
|
||||||
a->kind = kind;
|
a->kind = kind;
|
||||||
a->name = makeList1(makeString((char *) name));
|
a->name = list_make1(makeString((char *) name));
|
||||||
a->lexpr = lexpr;
|
a->lexpr = lexpr;
|
||||||
a->rexpr = rexpr;
|
a->rexpr = rexpr;
|
||||||
return a;
|
return a;
|
||||||
|
@ -259,7 +259,7 @@ makeTypeName(char *typnam)
|
||||||
{
|
{
|
||||||
TypeName *n = makeNode(TypeName);
|
TypeName *n = makeNode(TypeName);
|
||||||
|
|
||||||
n->names = makeList1(makeString(typnam));
|
n->names = list_make1(makeString(typnam));
|
||||||
n->typmod = -1;
|
n->typmod = -1;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* NOTES
|
||||||
* Every node type that can appear in stored rules' parsetrees *must*
|
* Every node type that can appear in stored rules' parsetrees *must*
|
||||||
|
@ -19,8 +19,6 @@
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#define DISABLE_LIST_COMPAT
|
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
|
@ -333,7 +333,7 @@ print_expr(Node *expr, List *rtable)
|
||||||
RangeTblEntry *rte;
|
RangeTblEntry *rte;
|
||||||
|
|
||||||
Assert(var->varno > 0 &&
|
Assert(var->varno > 0 &&
|
||||||
(int) var->varno <= length(rtable));
|
(int) var->varno <= list_length(rtable));
|
||||||
rte = rt_fetch(var->varno, rtable);
|
rte = rt_fetch(var->varno, rtable);
|
||||||
relname = rte->eref->aliasname;
|
relname = rte->eref->aliasname;
|
||||||
attname = get_rte_attribute_name(rte, var->varattno);
|
attname = get_rte_attribute_name(rte, var->varattno);
|
||||||
|
@ -378,7 +378,7 @@ print_expr(Node *expr, List *rtable)
|
||||||
char *opname;
|
char *opname;
|
||||||
|
|
||||||
opname = get_opname(e->opno);
|
opname = get_opname(e->opno);
|
||||||
if (length(e->args) > 1)
|
if (list_length(e->args) > 1)
|
||||||
{
|
{
|
||||||
print_expr(get_leftop((Expr *) e), rtable);
|
print_expr(get_leftop((Expr *) e), rtable);
|
||||||
printf(" %s ", ((opname != NULL) ? opname : "(invalid operator)"));
|
printf(" %s ", ((opname != NULL) ? opname : "(invalid operator)"));
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
|
@ -327,7 +327,7 @@ nodeRead(char *token, int tok_len)
|
||||||
if (endptr != token + tok_len)
|
if (endptr != token + tok_len)
|
||||||
elog(ERROR, "unrecognized integer: \"%.*s\"",
|
elog(ERROR, "unrecognized integer: \"%.*s\"",
|
||||||
tok_len, token);
|
tok_len, token);
|
||||||
l = lappendi(l, val);
|
l = lappend_int(l, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (tok_len == 1 && token[0] == 'o')
|
else if (tok_len == 1 && token[0] == 'o')
|
||||||
|
@ -347,7 +347,7 @@ nodeRead(char *token, int tok_len)
|
||||||
if (endptr != token + tok_len)
|
if (endptr != token + tok_len)
|
||||||
elog(ERROR, "unrecognized OID: \"%.*s\"",
|
elog(ERROR, "unrecognized OID: \"%.*s\"",
|
||||||
tok_len, token);
|
tok_len, token);
|
||||||
l = lappendo(l, val);
|
l = lappend_oid(l, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* NOTES
|
||||||
* Path and Plan nodes do not have any readfuncs support, because we
|
* Path and Plan nodes do not have any readfuncs support, because we
|
||||||
|
@ -18,8 +18,6 @@
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#define DISABLE_LIST_COMPAT
|
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* 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 */
|
/* Get the next input relation and push it */
|
||||||
cur_rel_index = (int) tour[rel_count];
|
cur_rel_index = (int) tour[rel_count];
|
||||||
stack[stack_depth] = (RelOptInfo *) nth(cur_rel_index - 1,
|
stack[stack_depth] = (RelOptInfo *) list_nth(evaldata->initial_rels,
|
||||||
evaldata->initial_rels);
|
cur_rel_index - 1);
|
||||||
stack_depth++;
|
stack_depth++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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.
|
* 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;
|
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
|
* XXX for now, can't handle inherited expansion of FOR UPDATE; can we
|
||||||
* do better?
|
* do better?
|
||||||
*/
|
*/
|
||||||
if (intMember(parentRTindex, root->rowMarks))
|
if (list_member_int(root->rowMarks, parentRTindex))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
errmsg("SELECT FOR UPDATE is not supported for inheritance queries")));
|
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)
|
foreach(il, inheritlist)
|
||||||
{
|
{
|
||||||
int childRTindex = lfirsti(il);
|
int childRTindex = lfirst_int(il);
|
||||||
RangeTblEntry *childrte;
|
RangeTblEntry *childrte;
|
||||||
Oid childOID;
|
Oid childOID;
|
||||||
RelOptInfo *childrel;
|
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 */
|
/* We need a workspace for keeping track of set-op type coercions */
|
||||||
differentTypes = (bool *)
|
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
|
* 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
|
* dynamic-programming algorithm we must employ to consider all ways
|
||||||
* of joining the child nodes.
|
* of joining the child nodes.
|
||||||
*/
|
*/
|
||||||
levels_needed = length(from->fromlist);
|
levels_needed = list_length(from->fromlist);
|
||||||
|
|
||||||
if (levels_needed <= 0)
|
if (levels_needed <= 0)
|
||||||
return NULL; /* nothing to do? */
|
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)
|
if (joinitems[levels_needed] == NIL)
|
||||||
elog(ERROR, "failed to build any %d-way joins", levels_needed);
|
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]);
|
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);
|
bms_free(tested);
|
||||||
|
|
||||||
return safe;
|
return safe;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* behave in the simple way we are expecting.) Most of the tests
|
||||||
* here can be done more efficiently with rinfo than without.
|
* 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;
|
OpExpr *expr = (OpExpr *) clause;
|
||||||
bool varonleft = true;
|
bool varonleft = true;
|
||||||
|
@ -480,8 +480,8 @@ clause_selectivity(Query *root,
|
||||||
*/
|
*/
|
||||||
s1 = restriction_selectivity(root,
|
s1 = restriction_selectivity(root,
|
||||||
BooleanEqualOperator,
|
BooleanEqualOperator,
|
||||||
makeList2(var,
|
list_make2(var,
|
||||||
makeBoolConst(true,
|
makeBoolConst(true,
|
||||||
false)),
|
false)),
|
||||||
varRelid);
|
varRelid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 startup_cost = 0;
|
||||||
Cost run_cost = 0;
|
Cost run_cost = 0;
|
||||||
Cost cpu_per_tuple;
|
Cost cpu_per_tuple;
|
||||||
int ntuples = length(tideval);
|
int ntuples = list_length(tideval);
|
||||||
|
|
||||||
/* Should only be applied to base relations */
|
/* Should only be applied to base relations */
|
||||||
Assert(baserel->relid > 0);
|
Assert(baserel->relid > 0);
|
||||||
|
@ -1063,7 +1063,7 @@ cost_hashjoin(HashPath *path, Query *root)
|
||||||
outer_path->parent->width);
|
outer_path->parent->width);
|
||||||
double innerbytes = relation_byte_size(inner_path_rows,
|
double innerbytes = relation_byte_size(inner_path_rows,
|
||||||
inner_path->parent->width);
|
inner_path->parent->width);
|
||||||
int num_hashclauses = length(hashclauses);
|
int num_hashclauses = list_length(hashclauses);
|
||||||
int virtualbuckets;
|
int virtualbuckets;
|
||||||
int physicalbuckets;
|
int physicalbuckets;
|
||||||
int numbatches;
|
int numbatches;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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;
|
Expr *nonnullarg = ((NullTest *) predicate)->arg;
|
||||||
|
|
||||||
if (is_opclause(clause) &&
|
if (is_opclause(clause) &&
|
||||||
member(nonnullarg, ((OpExpr *) clause)->args) &&
|
list_member(((OpExpr *) clause)->args, nonnullarg) &&
|
||||||
op_strict(((OpExpr *) clause)->opno))
|
op_strict(((OpExpr *) clause)->opno))
|
||||||
return true;
|
return true;
|
||||||
if (is_funcclause(clause) &&
|
if (is_funcclause(clause) &&
|
||||||
member(nonnullarg, ((FuncExpr *) clause)->args) &&
|
list_member(((FuncExpr *) clause)->args, nonnullarg) &&
|
||||||
func_strict(((FuncExpr *) clause)->funcid))
|
func_strict(((FuncExpr *) clause)->funcid))
|
||||||
return true;
|
return true;
|
||||||
return false; /* we can't succeed below... */
|
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;
|
* Note that we are making a pathnode for a single-scan indexscan;
|
||||||
* therefore, indexinfo etc should be single-element lists.
|
* therefore, indexinfo etc should be single-element lists.
|
||||||
*/
|
*/
|
||||||
pathnode->indexinfo = makeList1(index);
|
pathnode->indexinfo = list_make1(index);
|
||||||
pathnode->indexclauses = makeList1(allclauses);
|
pathnode->indexclauses = list_make1(allclauses);
|
||||||
pathnode->indexquals = makeList1(indexquals);
|
pathnode->indexquals = list_make1(indexquals);
|
||||||
|
|
||||||
pathnode->isjoininner = true;
|
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
|
* Always assume the join type is JOIN_INNER; even if some of the join
|
||||||
* clauses come from other contexts, that's not our problem.
|
* 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 *
|
pathnode->rows = rel->tuples *
|
||||||
clauselist_selectivity(root,
|
clauselist_selectivity(root,
|
||||||
allclauses,
|
allclauses,
|
||||||
|
@ -1679,7 +1679,7 @@ flatten_clausegroups_list(List *clausegroups)
|
||||||
|
|
||||||
foreach(l, clausegroups)
|
foreach(l, clausegroups)
|
||||||
{
|
{
|
||||||
allclauses = nconc(allclauses, listCopy((List *) lfirst(l)));
|
allclauses = list_concat(allclauses, list_copy((List *) lfirst(l)));
|
||||||
}
|
}
|
||||||
return allclauses;
|
return allclauses;
|
||||||
}
|
}
|
||||||
|
@ -1711,7 +1711,7 @@ make_expr_from_indexclauses(List *indexclauses)
|
||||||
orclauses = lappend(orclauses, make_ands_explicit(andlist));
|
orclauses = lappend(orclauses, make_ands_explicit(andlist));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length(orclauses) > 1)
|
if (list_length(orclauses) > 1)
|
||||||
return make_orclause(orclauses);
|
return make_orclause(orclauses);
|
||||||
else
|
else
|
||||||
return (Expr *) linitial(orclauses);
|
return (Expr *) linitial(orclauses);
|
||||||
|
@ -2114,7 +2114,7 @@ expand_indexqual_condition(RestrictInfo *rinfo, Oid opclass)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
result = makeList1(rinfo);
|
result = list_make1(rinfo);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2209,7 +2209,7 @@ prefix_quals(Node *leftop, Oid opclass,
|
||||||
elog(ERROR, "no = operator for opclass %u", opclass);
|
elog(ERROR, "no = operator for opclass %u", opclass);
|
||||||
expr = make_opclause(oproid, BOOLOID, false,
|
expr = make_opclause(oproid, BOOLOID, false,
|
||||||
(Expr *) leftop, (Expr *) prefix_const);
|
(Expr *) leftop, (Expr *) prefix_const);
|
||||||
result = makeList1(make_restrictinfo(expr, true, true));
|
result = list_make1(make_restrictinfo(expr, true, true));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2224,7 +2224,7 @@ prefix_quals(Node *leftop, Oid opclass,
|
||||||
elog(ERROR, "no >= operator for opclass %u", opclass);
|
elog(ERROR, "no >= operator for opclass %u", opclass);
|
||||||
expr = make_opclause(oproid, BOOLOID, false,
|
expr = make_opclause(oproid, BOOLOID, false,
|
||||||
(Expr *) leftop, (Expr *) prefix_const);
|
(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
|
* 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 *) leftop,
|
||||||
(Expr *) makeConst(datatype, -1, opr1right,
|
(Expr *) makeConst(datatype, -1, opr1right,
|
||||||
false, false));
|
false, false));
|
||||||
result = makeList1(make_restrictinfo(expr, true, true));
|
result = list_make1(make_restrictinfo(expr, true, true));
|
||||||
|
|
||||||
/* create clause "key <= network_scan_last( rightop )" */
|
/* create clause "key <= network_scan_last( rightop )" */
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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. */
|
/* Make a pathkey list with this guy first. */
|
||||||
if (l != list_head(all_pathkeys))
|
if (l != list_head(all_pathkeys))
|
||||||
cur_pathkeys = lcons(front_pathkey,
|
cur_pathkeys = lcons(front_pathkey,
|
||||||
lremove(front_pathkey,
|
list_delete_ptr(list_copy(all_pathkeys),
|
||||||
listCopy(all_pathkeys)));
|
front_pathkey));
|
||||||
else
|
else
|
||||||
cur_pathkeys = all_pathkeys; /* no work at first one... */
|
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 */
|
/* Forget it if can't use all the clauses in right/full join */
|
||||||
if (useallclauses &&
|
if (useallclauses &&
|
||||||
length(cur_mergeclauses) != length(mergeclause_list))
|
list_length(cur_mergeclauses) != list_length(mergeclause_list))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -510,7 +510,7 @@ match_unsorted_outer(Query *root,
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (useallclauses && length(mergeclauses) != length(mergeclause_list))
|
if (useallclauses && list_length(mergeclauses) != list_length(mergeclause_list))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Compute the required ordering of the inner path */
|
/* 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
|
* consider both cheap startup cost and cheap total cost. Ignore
|
||||||
* inner_cheapest_total, since we already made a path with it.
|
* 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)
|
if (num_sortkeys > 1 && !useallclauses)
|
||||||
trialsortkeys = listCopy(innersortkeys); /* need modifiable copy */
|
trialsortkeys = list_copy(innersortkeys); /* need modifiable copy */
|
||||||
else
|
else
|
||||||
trialsortkeys = innersortkeys; /* won't really truncate */
|
trialsortkeys = innersortkeys; /* won't really truncate */
|
||||||
cheapest_startup_inner = NULL;
|
cheapest_startup_inner = NULL;
|
||||||
|
@ -565,7 +565,7 @@ match_unsorted_outer(Query *root,
|
||||||
* 'sortkeycnt' innersortkeys. NB: trialsortkeys list is
|
* 'sortkeycnt' innersortkeys. NB: trialsortkeys list is
|
||||||
* modified destructively, which is why we made a copy...
|
* 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,
|
innerpath = get_cheapest_path_for_pathkeys(innerrel->pathlist,
|
||||||
trialsortkeys,
|
trialsortkeys,
|
||||||
TOTAL_COST);
|
TOTAL_COST);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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);
|
RelOptInfo *jrel = (RelOptInfo *) lfirst(nr);
|
||||||
|
|
||||||
if (!ptrMember(jrel, result_rels))
|
if (!list_member_ptr(result_rels, jrel))
|
||||||
result_rels = lcons(jrel, result_rels);
|
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,
|
jrel = make_join_rel(root, old_rel, new_rel,
|
||||||
JOIN_INNER);
|
JOIN_INNER);
|
||||||
/* Avoid making duplicate entries ... */
|
/* Avoid making duplicate entries ... */
|
||||||
if (jrel && !ptrMember(jrel, result_rels))
|
if (jrel && !list_member_ptr(result_rels, jrel))
|
||||||
result_rels = lcons(jrel, result_rels);
|
result_rels = lcons(jrel, result_rels);
|
||||||
break; /* need not consider more
|
break; /* need not consider more
|
||||||
* joininfos */
|
* joininfos */
|
||||||
|
@ -234,7 +234,7 @@ make_rels_by_joins(Query *root, int level, List **joinrels)
|
||||||
{
|
{
|
||||||
RelOptInfo *jrel = (RelOptInfo *) lfirst(nr);
|
RelOptInfo *jrel = (RelOptInfo *) lfirst(nr);
|
||||||
|
|
||||||
if (!ptrMember(jrel, result_rels))
|
if (!list_member_ptr(result_rels, jrel))
|
||||||
result_rels = lcons(jrel, result_rels);
|
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
|
* Avoid entering same joinrel into our output list more
|
||||||
* than once.
|
* than once.
|
||||||
*/
|
*/
|
||||||
if (jrel && !ptrMember(jrel, result))
|
if (jrel && !list_member_ptr(result, jrel))
|
||||||
result = lcons(jrel, result);
|
result = lcons(jrel, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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,
|
newrinfos = make_restrictinfo_from_indexclauses(bestpath->indexclauses,
|
||||||
true, true);
|
true, true);
|
||||||
Assert(length(newrinfos) == 1);
|
Assert(list_length(newrinfos) == 1);
|
||||||
or_rinfo = (RestrictInfo *) linitial(newrinfos);
|
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
|
* Adjust the original OR clause's cached selectivity to compensate
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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)
|
while (cursetlink)
|
||||||
{
|
{
|
||||||
List *curset = (List *) lfirst(cursetlink);
|
List *curset = (List *) lfirst(cursetlink);
|
||||||
bool item1here = member(item1, curset);
|
bool item1here = list_member(curset, item1);
|
||||||
bool item2here = member(item2, curset);
|
bool item2here = list_member(curset, item2);
|
||||||
|
|
||||||
/* must advance cursetlink before lremove possibly pfree's it */
|
/* must advance cursetlink before lremove possibly pfree's it */
|
||||||
cursetlink = lnext(cursetlink);
|
cursetlink = lnext(cursetlink);
|
||||||
|
@ -147,22 +147,22 @@ add_equijoined_keys(Query *root, RestrictInfo *restrictinfo)
|
||||||
|
|
||||||
/* Build the new set only when we know we must */
|
/* Build the new set only when we know we must */
|
||||||
if (newset == NIL)
|
if (newset == NIL)
|
||||||
newset = makeList2(item1, item2);
|
newset = list_make2(item1, item2);
|
||||||
|
|
||||||
/* Found a set to merge into our new set */
|
/* 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.
|
* Remove old set from equi_key_list.
|
||||||
*/
|
*/
|
||||||
root->equi_key_list = lremove(curset, root->equi_key_list);
|
root->equi_key_list = list_delete_ptr(root->equi_key_list, curset);
|
||||||
freeList(curset); /* might as well recycle old cons cells */
|
list_free(curset); /* might as well recycle old cons cells */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build the new set only when we know we must */
|
/* Build the new set only when we know we must */
|
||||||
if (newset == NIL)
|
if (newset == NIL)
|
||||||
newset = makeList2(item1, item2);
|
newset = list_make2(item1, item2);
|
||||||
|
|
||||||
root->equi_key_list = lcons(newset, root->equi_key_list);
|
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)
|
foreach(cursetlink, root->equi_key_list)
|
||||||
{
|
{
|
||||||
List *curset = (List *) lfirst(cursetlink);
|
List *curset = (List *) lfirst(cursetlink);
|
||||||
int nitems = length(curset);
|
int nitems = list_length(curset);
|
||||||
Relids *relids;
|
Relids *relids;
|
||||||
bool have_consts;
|
bool have_consts;
|
||||||
ListCell *ptr1;
|
ListCell *ptr1;
|
||||||
|
@ -341,10 +341,10 @@ make_canonical_pathkey(Query *root, PathKeyItem *item)
|
||||||
{
|
{
|
||||||
List *curset = (List *) lfirst(cursetlink);
|
List *curset = (List *) lfirst(cursetlink);
|
||||||
|
|
||||||
if (member(item, curset))
|
if (list_member(curset, item))
|
||||||
return curset;
|
return curset;
|
||||||
}
|
}
|
||||||
newset = makeList1(item);
|
newset = list_make1(item);
|
||||||
root->equi_key_list = lcons(newset, root->equi_key_list);
|
root->equi_key_list = lcons(newset, root->equi_key_list);
|
||||||
return newset;
|
return newset;
|
||||||
}
|
}
|
||||||
|
@ -383,7 +383,7 @@ canonicalize_pathkeys(Query *root, List *pathkeys)
|
||||||
* canonicalized the keys, so that equivalent-key knowledge is
|
* canonicalized the keys, so that equivalent-key knowledge is
|
||||||
* used when deciding if an item is redundant.
|
* 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);
|
new_pathkeys = lappend(new_pathkeys, cpathkey);
|
||||||
}
|
}
|
||||||
return new_pathkeys;
|
return new_pathkeys;
|
||||||
|
@ -408,8 +408,8 @@ count_canonical_peers(Query *root, PathKeyItem *item)
|
||||||
{
|
{
|
||||||
List *curset = (List *) lfirst(cursetlink);
|
List *curset = (List *) lfirst(cursetlink);
|
||||||
|
|
||||||
if (member(item, curset))
|
if (list_member(curset, item))
|
||||||
return length(curset) - 1;
|
return list_length(curset) - 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -443,8 +443,8 @@ compare_pathkeys(List *keys1, List *keys2)
|
||||||
* input, but query root not accessible here...
|
* input, but query root not accessible here...
|
||||||
*/
|
*/
|
||||||
#ifdef NOT_USED
|
#ifdef NOT_USED
|
||||||
Assert(ptrMember(subkey1, root->equi_key_list));
|
Assert(list_member_ptr(root->equi_key_list, subkey1));
|
||||||
Assert(ptrMember(subkey2, root->equi_key_list));
|
Assert(list_member_ptr(root->equi_key_list, subkey2));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -499,8 +499,8 @@ compare_noncanonical_pathkeys(List *keys1, List *keys2)
|
||||||
List *subkey1 = (List *) lfirst(key1);
|
List *subkey1 = (List *) lfirst(key1);
|
||||||
List *subkey2 = (List *) lfirst(key2);
|
List *subkey2 = (List *) lfirst(key2);
|
||||||
|
|
||||||
Assert(length(subkey1) == 1);
|
Assert(list_length(subkey1) == 1);
|
||||||
Assert(length(subkey2) == 1);
|
Assert(list_length(subkey2) == 1);
|
||||||
if (!equal(subkey1, subkey2))
|
if (!equal(subkey1, subkey2))
|
||||||
return PATHKEYS_DIFFERENT; /* no need to keep looking */
|
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
|
* Eliminate redundant ordering info; could happen if query is
|
||||||
* such that index keys are equijoined...
|
* such that index keys are equijoined...
|
||||||
*/
|
*/
|
||||||
if (!ptrMember(cpathkey, retval))
|
if (!list_member_ptr(retval, cpathkey))
|
||||||
retval = lappend(retval, cpathkey);
|
retval = lappend(retval, cpathkey);
|
||||||
|
|
||||||
indexkeys++;
|
indexkeys++;
|
||||||
|
@ -752,7 +752,7 @@ build_subquery_pathkeys(Query *root, RelOptInfo *rel, Query *subquery)
|
||||||
{
|
{
|
||||||
List *retval = NIL;
|
List *retval = NIL;
|
||||||
int retvallen = 0;
|
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;
|
List *sub_tlist = rel->subplan->targetlist;
|
||||||
ListCell *i;
|
ListCell *i;
|
||||||
|
|
||||||
|
@ -810,8 +810,7 @@ build_subquery_pathkeys(Query *root, RelOptInfo *rel, Query *subquery)
|
||||||
score = count_canonical_peers(root, outer_item);
|
score = count_canonical_peers(root, outer_item);
|
||||||
/* +1 if it matches the proper query_pathkeys item */
|
/* +1 if it matches the proper query_pathkeys item */
|
||||||
if (retvallen < outer_query_keys &&
|
if (retvallen < outer_query_keys &&
|
||||||
member(outer_item,
|
list_member(list_nth(root->query_pathkeys, retvallen), outer_item))
|
||||||
nth(retvallen, root->query_pathkeys)))
|
|
||||||
score++;
|
score++;
|
||||||
if (score > best_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
|
* Eliminate redundant ordering info; could happen if outer query
|
||||||
* equijoins subquery keys...
|
* equijoins subquery keys...
|
||||||
*/
|
*/
|
||||||
if (!ptrMember(cpathkey, retval))
|
if (!list_member_ptr(retval, cpathkey))
|
||||||
{
|
{
|
||||||
retval = lappend(retval, cpathkey);
|
retval = lappend(retval, cpathkey);
|
||||||
retvallen++;
|
retvallen++;
|
||||||
|
@ -920,7 +919,7 @@ make_pathkeys_for_sortclauses(List *sortclauses,
|
||||||
* canonicalize_pathkeys() might replace it with a longer sublist
|
* canonicalize_pathkeys() might replace it with a longer sublist
|
||||||
* later.
|
* later.
|
||||||
*/
|
*/
|
||||||
pathkeys = lappend(pathkeys, makeList1(pathkey));
|
pathkeys = lappend(pathkeys, list_make1(pathkey));
|
||||||
}
|
}
|
||||||
return pathkeys;
|
return pathkeys;
|
||||||
}
|
}
|
||||||
|
@ -1041,7 +1040,7 @@ find_mergeclauses_for_pathkeys(Query *root,
|
||||||
*/
|
*/
|
||||||
if ((pathkey == restrictinfo->left_pathkey ||
|
if ((pathkey == restrictinfo->left_pathkey ||
|
||||||
pathkey == restrictinfo->right_pathkey) &&
|
pathkey == restrictinfo->right_pathkey) &&
|
||||||
!ptrMember(restrictinfo, mergeclauses))
|
!list_member_ptr(mergeclauses, restrictinfo))
|
||||||
{
|
{
|
||||||
matched_restrictinfos = lappend(matched_restrictinfos,
|
matched_restrictinfos = lappend(matched_restrictinfos,
|
||||||
restrictinfo);
|
restrictinfo);
|
||||||
|
@ -1060,7 +1059,7 @@ find_mergeclauses_for_pathkeys(Query *root,
|
||||||
* If we did find usable mergeclause(s) for this sort-key
|
* If we did find usable mergeclause(s) for this sort-key
|
||||||
* position, add them to result list.
|
* position, add them to result list.
|
||||||
*/
|
*/
|
||||||
mergeclauses = nconc(mergeclauses, matched_restrictinfos);
|
mergeclauses = list_concat(mergeclauses, matched_restrictinfos);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mergeclauses;
|
return mergeclauses;
|
||||||
|
@ -1124,7 +1123,7 @@ make_pathkeys_for_mergeclauses(Query *root,
|
||||||
* pathkey, a simple ptrMember test is sufficient to detect
|
* pathkey, a simple ptrMember test is sufficient to detect
|
||||||
* redundant keys.
|
* redundant keys.
|
||||||
*/
|
*/
|
||||||
if (!ptrMember(pathkey, pathkeys))
|
if (!list_member_ptr(pathkeys, pathkey))
|
||||||
pathkeys = lappend(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
|
* 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.
|
* 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
|
int
|
||||||
pathkeys_useful_for_ordering(Query *root, List *pathkeys)
|
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))
|
if (pathkeys_contained_in(root->query_pathkeys, pathkeys))
|
||||||
{
|
{
|
||||||
/* It's useful ... or at least the first N keys are */
|
/* 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 */
|
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
|
* Note: not safe to modify input list destructively, but we can avoid
|
||||||
* copying the list if we're not actually going to change it
|
* copying the list if we're not actually going to change it
|
||||||
*/
|
*/
|
||||||
if (nuseful == length(pathkeys))
|
if (nuseful == list_length(pathkeys))
|
||||||
return pathkeys;
|
return pathkeys;
|
||||||
else
|
else
|
||||||
return ltruncate(nuseful, listCopy(pathkeys));
|
return list_truncate(list_copy(pathkeys), nuseful);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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)
|
if (node->opno != TIDEqualOperator)
|
||||||
return rnode;
|
return rnode;
|
||||||
if (length(node->args) != 2)
|
if (list_length(node->args) != 2)
|
||||||
return rnode;
|
return rnode;
|
||||||
arg1 = linitial(node->args);
|
arg1 = linitial(node->args);
|
||||||
arg2 = lsecond(node->args);
|
arg2 = lsecond(node->args);
|
||||||
|
@ -184,11 +184,11 @@ TidqualFromExpr(int varno, Expr *expr)
|
||||||
node = (Node *) lfirst(l);
|
node = (Node *) lfirst(l);
|
||||||
frtn = TidqualFromExpr(varno, (Expr *) node);
|
frtn = TidqualFromExpr(varno, (Expr *) node);
|
||||||
if (frtn)
|
if (frtn)
|
||||||
rlst = nconc(rlst, frtn);
|
rlst = list_concat(rlst, frtn);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (rlst)
|
if (rlst)
|
||||||
freeList(rlst);
|
list_free(rlst);
|
||||||
rlst = NIL;
|
rlst = NIL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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)
|
if (get_loc_restrictinfo(best_path) != NIL)
|
||||||
set_qpqual((Plan) plan,
|
set_qpqual((Plan) plan,
|
||||||
nconc(get_qpqual((Plan) plan),
|
list_concat(get_qpqual((Plan) plan),
|
||||||
get_actual_clauses(get_loc_restrictinfo(best_path))));
|
get_actual_clauses(get_loc_restrictinfo(best_path))));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -548,12 +548,12 @@ create_unique_plan(Query *root, UniquePath *best_path)
|
||||||
elog(ERROR, "could not find UniquePath in in_info_list");
|
elog(ERROR, "could not find UniquePath in in_info_list");
|
||||||
|
|
||||||
/* set up to record positions of unique columns */
|
/* set up to record positions of unique columns */
|
||||||
numGroupCols = length(uniq_exprs);
|
numGroupCols = list_length(uniq_exprs);
|
||||||
groupColIdx = (AttrNumber *) palloc(numGroupCols * sizeof(AttrNumber));
|
groupColIdx = (AttrNumber *) palloc(numGroupCols * sizeof(AttrNumber));
|
||||||
groupColPos = 0;
|
groupColPos = 0;
|
||||||
/* not sure if tlist might be shared with other nodes, so copy */
|
/* not sure if tlist might be shared with other nodes, so copy */
|
||||||
newtlist = copyObject(subplan->targetlist);
|
newtlist = copyObject(subplan->targetlist);
|
||||||
nextresno = length(newtlist) + 1;
|
nextresno = list_length(newtlist) + 1;
|
||||||
newitems = false;
|
newitems = false;
|
||||||
|
|
||||||
foreach(l, uniq_exprs)
|
foreach(l, uniq_exprs)
|
||||||
|
@ -725,9 +725,9 @@ create_indexscan_plan(Query *root,
|
||||||
* need to worry about the plain AND case. Also, pointer comparison
|
* need to worry about the plain AND case. Also, pointer comparison
|
||||||
* should be enough to determine RestrictInfo matches.
|
* should be enough to determine RestrictInfo matches.
|
||||||
*/
|
*/
|
||||||
Assert(length(best_path->indexclauses) == 1);
|
Assert(list_length(best_path->indexclauses) == 1);
|
||||||
scan_clauses = set_ptrUnion(scan_clauses,
|
scan_clauses = list_union_ptr(scan_clauses,
|
||||||
(List *) linitial(best_path->indexclauses));
|
(List *) linitial(best_path->indexclauses));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reduce RestrictInfo list to bare expressions */
|
/* 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
|
* added to qpqual. The upshot is that qpquals must contain scan_clauses
|
||||||
* minus whatever appears in indxquals.
|
* minus whatever appears in indxquals.
|
||||||
*/
|
*/
|
||||||
if (length(indxquals) > 1)
|
if (list_length(indxquals) > 1)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Build an expression representation of the indexqual, expanding
|
* 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.)
|
* scan_clause are not great; perhaps we need more smarts here.)
|
||||||
*/
|
*/
|
||||||
indxqual_or_expr = make_expr_from_indexclauses(indxquals);
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -785,7 +785,7 @@ create_indexscan_plan(Query *root,
|
||||||
* behavior.
|
* behavior.
|
||||||
*/
|
*/
|
||||||
Assert(stripped_indxquals != NIL);
|
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;
|
List *indexclauses = innerpath->indexclauses;
|
||||||
|
|
||||||
if (innerpath->isjoininner &&
|
if (innerpath->isjoininner &&
|
||||||
length(indexclauses) == 1) /* single indexscan? */
|
list_length(indexclauses) == 1) /* single indexscan? */
|
||||||
{
|
{
|
||||||
joinrestrictclauses =
|
joinrestrictclauses =
|
||||||
select_nonredundant_join_clauses(root,
|
select_nonredundant_join_clauses(root,
|
||||||
|
@ -1019,7 +1019,7 @@ create_mergejoin_plan(Query *root,
|
||||||
* the list of quals that must be checked as qpquals.
|
* the list of quals that must be checked as qpquals.
|
||||||
*/
|
*/
|
||||||
mergeclauses = get_actual_clauses(best_path->path_mergeclauses);
|
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
|
* 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.
|
* the list of quals that must be checked as qpquals.
|
||||||
*/
|
*/
|
||||||
hashclauses = get_actual_clauses(best_path->path_hashclauses);
|
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
|
* Rearrange hashclauses, if needed, so that the outer variable is
|
||||||
|
@ -1248,7 +1248,7 @@ fix_indxqual_sublist(List *indexqual,
|
||||||
|
|
||||||
Assert(IsA(rinfo, RestrictInfo));
|
Assert(IsA(rinfo, RestrictInfo));
|
||||||
clause = (OpExpr *) rinfo->clause;
|
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");
|
elog(ERROR, "indexqual clause is not binary opclause");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1287,9 +1287,9 @@ fix_indxqual_sublist(List *indexqual,
|
||||||
get_op_opclass_properties(newclause->opno, opclass,
|
get_op_opclass_properties(newclause->opno, opclass,
|
||||||
&stratno, &stratsubtype, &recheck);
|
&stratno, &stratsubtype, &recheck);
|
||||||
|
|
||||||
*strategy = lappendi(*strategy, stratno);
|
*strategy = lappend_int(*strategy, stratno);
|
||||||
*subtype = lappendo(*subtype, stratsubtype);
|
*subtype = lappend_oid(*subtype, stratsubtype);
|
||||||
*lossy = lappendi(*lossy, (int) recheck);
|
*lossy = lappend_int(*lossy, (int) recheck);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1401,7 +1401,7 @@ get_switched_clauses(List *clauses, Relids outerrelids)
|
||||||
temp->opfuncid = InvalidOid;
|
temp->opfuncid = InvalidOid;
|
||||||
temp->opresulttype = clause->opresulttype;
|
temp->opresulttype = clause->opresulttype;
|
||||||
temp->opretset = clause->opretset;
|
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. */
|
/* Commute it --- note this modifies the temp node in-place. */
|
||||||
CommuteClause(temp);
|
CommuteClause(temp);
|
||||||
t_list = lappend(t_list, temp);
|
t_list = lappend(t_list, temp);
|
||||||
|
@ -1839,8 +1839,8 @@ make_sort_from_pathkeys(Query *root, Plan *lefttree, List *pathkeys)
|
||||||
AttrNumber *sortColIdx;
|
AttrNumber *sortColIdx;
|
||||||
Oid *sortOperators;
|
Oid *sortOperators;
|
||||||
|
|
||||||
/* We will need at most length(pathkeys) sort columns; possibly less */
|
/* We will need at most list_length(pathkeys) sort columns; possibly less */
|
||||||
numsortkeys = length(pathkeys);
|
numsortkeys = list_length(pathkeys);
|
||||||
sortColIdx = (AttrNumber *) palloc(numsortkeys * sizeof(AttrNumber));
|
sortColIdx = (AttrNumber *) palloc(numsortkeys * sizeof(AttrNumber));
|
||||||
sortOperators = (Oid *) palloc(numsortkeys * sizeof(Oid));
|
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))
|
if (!tlist_member(lfirst(k), tlist))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
freeList(exprvars);
|
list_free(exprvars);
|
||||||
if (!k)
|
if (!k)
|
||||||
break; /* found usable expression */
|
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
|
* Add resjunk entry to input's tlist
|
||||||
*/
|
*/
|
||||||
resdom = makeResdom(length(tlist) + 1,
|
resdom = makeResdom(list_length(tlist) + 1,
|
||||||
exprType(pathkey->key),
|
exprType(pathkey->key),
|
||||||
exprTypmod(pathkey->key),
|
exprTypmod(pathkey->key),
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -1950,8 +1950,8 @@ make_sort_from_sortclauses(Query *root, List *sortcls, Plan *lefttree)
|
||||||
AttrNumber *sortColIdx;
|
AttrNumber *sortColIdx;
|
||||||
Oid *sortOperators;
|
Oid *sortOperators;
|
||||||
|
|
||||||
/* We will need at most length(sortcls) sort columns; possibly less */
|
/* We will need at most list_length(sortcls) sort columns; possibly less */
|
||||||
numsortkeys = length(sortcls);
|
numsortkeys = list_length(sortcls);
|
||||||
sortColIdx = (AttrNumber *) palloc(numsortkeys * sizeof(AttrNumber));
|
sortColIdx = (AttrNumber *) palloc(numsortkeys * sizeof(AttrNumber));
|
||||||
sortOperators = (Oid *) palloc(numsortkeys * sizeof(Oid));
|
sortOperators = (Oid *) palloc(numsortkeys * sizeof(Oid));
|
||||||
|
|
||||||
|
@ -2003,8 +2003,8 @@ make_sort_from_groupcols(Query *root,
|
||||||
AttrNumber *sortColIdx;
|
AttrNumber *sortColIdx;
|
||||||
Oid *sortOperators;
|
Oid *sortOperators;
|
||||||
|
|
||||||
/* We will need at most length(groupcls) sort columns; possibly less */
|
/* We will need at most list_length(groupcls) sort columns; possibly less */
|
||||||
numsortkeys = length(groupcls);
|
numsortkeys = list_length(groupcls);
|
||||||
sortColIdx = (AttrNumber *) palloc(numsortkeys * sizeof(AttrNumber));
|
sortColIdx = (AttrNumber *) palloc(numsortkeys * sizeof(AttrNumber));
|
||||||
sortOperators = (Oid *) palloc(numsortkeys * sizeof(Oid));
|
sortOperators = (Oid *) palloc(numsortkeys * sizeof(Oid));
|
||||||
|
|
||||||
|
@ -2207,7 +2207,7 @@ make_unique(Plan *lefttree, List *distinctList)
|
||||||
{
|
{
|
||||||
Unique *node = makeNode(Unique);
|
Unique *node = makeNode(Unique);
|
||||||
Plan *plan = &node->plan;
|
Plan *plan = &node->plan;
|
||||||
int numCols = length(distinctList);
|
int numCols = list_length(distinctList);
|
||||||
int keyno = 0;
|
int keyno = 0;
|
||||||
AttrNumber *uniqColIdx;
|
AttrNumber *uniqColIdx;
|
||||||
ListCell *slitem;
|
ListCell *slitem;
|
||||||
|
@ -2264,7 +2264,7 @@ make_setop(SetOpCmd cmd, Plan *lefttree,
|
||||||
{
|
{
|
||||||
SetOp *node = makeNode(SetOp);
|
SetOp *node = makeNode(SetOp);
|
||||||
Plan *plan = &node->plan;
|
Plan *plan = &node->plan;
|
||||||
int numCols = length(distinctList);
|
int numCols = list_length(distinctList);
|
||||||
int keyno = 0;
|
int keyno = 0;
|
||||||
AttrNumber *dupColIdx;
|
AttrNumber *dupColIdx;
|
||||||
ListCell *slitem;
|
ListCell *slitem;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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)
|
if (tlist_vars != NIL)
|
||||||
{
|
{
|
||||||
add_vars_to_targetlist(root, tlist_vars, bms_make_singleton(0));
|
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 (rel->outerjoinset == NULL)
|
||||||
{
|
{
|
||||||
if (intMember(relno, root->rowMarks))
|
if (list_member_int(root->rowMarks, relno))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
errmsg("SELECT FOR UPDATE cannot be applied to the nullable side of an outer join")));
|
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);
|
vars = pull_var_clause(clause, false);
|
||||||
add_vars_to_targetlist(root, vars, relids);
|
add_vars_to_targetlist(root, vars, relids);
|
||||||
freeList(vars);
|
list_free(vars);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
|
@ -705,8 +705,8 @@ process_implied_equality(Query *root,
|
||||||
if (membership == BMS_SINGLETON)
|
if (membership == BMS_SINGLETON)
|
||||||
{
|
{
|
||||||
/* delete it from local restrictinfo list */
|
/* delete it from local restrictinfo list */
|
||||||
rel1->baserestrictinfo = lremove(restrictinfo,
|
rel1->baserestrictinfo = list_delete_ptr(rel1->baserestrictinfo,
|
||||||
rel1->baserestrictinfo);
|
restrictinfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -728,7 +728,7 @@ process_implied_equality(Query *root,
|
||||||
*/
|
*/
|
||||||
ltype = exprType(item1);
|
ltype = exprType(item1);
|
||||||
rtype = exprType(item2);
|
rtype = exprType(item2);
|
||||||
eq_operator = compatible_oper(makeList1(makeString("=")),
|
eq_operator = compatible_oper(list_make1(makeString("=")),
|
||||||
ltype, rtype, true);
|
ltype, rtype, true);
|
||||||
if (!HeapTupleIsValid(eq_operator))
|
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
|
* done. We give up when we can't expand the equalexprs list any
|
||||||
* more.
|
* more.
|
||||||
*/
|
*/
|
||||||
equalexprs = makeList1(newleft);
|
equalexprs = list_make1(newleft);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
someadded = false;
|
someadded = false;
|
||||||
/* cannot use foreach here because of possible lremove */
|
/* cannot use foreach here because of possible list_delete */
|
||||||
olditem = list_head(oldquals);
|
olditem = list_head(oldquals);
|
||||||
while (olditem)
|
while (olditem)
|
||||||
{
|
{
|
||||||
|
@ -867,12 +867,12 @@ qual_is_redundant(Query *root,
|
||||||
Node *oldright = get_rightop(oldrinfo->clause);
|
Node *oldright = get_rightop(oldrinfo->clause);
|
||||||
Node *newguy = NULL;
|
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);
|
olditem = lnext(olditem);
|
||||||
|
|
||||||
if (member(oldleft, equalexprs))
|
if (list_member(equalexprs, oldleft))
|
||||||
newguy = oldright;
|
newguy = oldright;
|
||||||
else if (member(oldright, equalexprs))
|
else if (list_member(equalexprs, oldright))
|
||||||
newguy = oldleft;
|
newguy = oldleft;
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
@ -884,7 +884,7 @@ qual_is_redundant(Query *root,
|
||||||
/*
|
/*
|
||||||
* Remove this qual from list, since we don't need it anymore.
|
* Remove this qual from list, since we don't need it anymore.
|
||||||
*/
|
*/
|
||||||
oldquals = lremove(oldrinfo, oldquals);
|
oldquals = list_delete_ptr(oldquals, oldrinfo);
|
||||||
}
|
}
|
||||||
} while (someadded);
|
} while (someadded);
|
||||||
|
|
||||||
|
@ -917,7 +917,7 @@ check_mergejoinable(RestrictInfo *restrictinfo)
|
||||||
|
|
||||||
if (!is_opclause(clause))
|
if (!is_opclause(clause))
|
||||||
return;
|
return;
|
||||||
if (length(((OpExpr *) clause)->args) != 2)
|
if (list_length(((OpExpr *) clause)->args) != 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
opno = ((OpExpr *) clause)->opno;
|
opno = ((OpExpr *) clause)->opno;
|
||||||
|
@ -950,7 +950,7 @@ check_hashjoinable(RestrictInfo *restrictinfo)
|
||||||
|
|
||||||
if (!is_opclause(clause))
|
if (!is_opclause(clause))
|
||||||
return;
|
return;
|
||||||
if (length(((OpExpr *) clause)->args) != 2)
|
if (list_length(((OpExpr *) clause)->args) != 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
opno = ((OpExpr *) clause)->opno;
|
opno = ((OpExpr *) clause)->opno;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 */
|
/* 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 */
|
/* final cleanup of the plan */
|
||||||
set_plan_references(result_plan, parse->rtable);
|
set_plan_references(result_plan, parse->rtable);
|
||||||
|
@ -493,14 +493,14 @@ inheritance_planner(Query *parse, List *inheritlist)
|
||||||
{
|
{
|
||||||
int parentRTindex = parse->resultRelation;
|
int parentRTindex = parse->resultRelation;
|
||||||
Oid parentOID = getrelid(parentRTindex, parse->rtable);
|
Oid parentOID = getrelid(parentRTindex, parse->rtable);
|
||||||
int mainrtlength = length(parse->rtable);
|
int mainrtlength = list_length(parse->rtable);
|
||||||
List *subplans = NIL;
|
List *subplans = NIL;
|
||||||
List *tlist = NIL;
|
List *tlist = NIL;
|
||||||
ListCell *l;
|
ListCell *l;
|
||||||
|
|
||||||
foreach(l, inheritlist)
|
foreach(l, inheritlist)
|
||||||
{
|
{
|
||||||
int childRTindex = lfirsti(l);
|
int childRTindex = lfirst_int(l);
|
||||||
Oid childOID = getrelid(childRTindex, parse->rtable);
|
Oid childOID = getrelid(childRTindex, parse->rtable);
|
||||||
int subrtlength;
|
int subrtlength;
|
||||||
Query *subquery;
|
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
|
* XXX my goodness this is ugly. Really need to think about ways to
|
||||||
* rein in planner's habit of scribbling on its input.
|
* rein in planner's habit of scribbling on its input.
|
||||||
*/
|
*/
|
||||||
subrtlength = length(subquery->rtable);
|
subrtlength = list_length(subquery->rtable);
|
||||||
if (subrtlength > mainrtlength)
|
if (subrtlength > mainrtlength)
|
||||||
{
|
{
|
||||||
List *subrt;
|
List *subrt;
|
||||||
|
|
||||||
subrt = list_copy_tail(subquery->rtable, mainrtlength);
|
subrt = list_copy_tail(subquery->rtable, mainrtlength);
|
||||||
parse->rtable = nconc(parse->rtable, subrt);
|
parse->rtable = list_concat(parse->rtable, subrt);
|
||||||
mainrtlength = subrtlength;
|
mainrtlength = subrtlength;
|
||||||
}
|
}
|
||||||
/* Save preprocessed tlist from first rel for use in Append */
|
/* Save preprocessed tlist from first rel for use in Append */
|
||||||
|
@ -634,7 +634,7 @@ grouping_planner(Query *parse, double tuple_fraction)
|
||||||
double dNumGroups = 0;
|
double dNumGroups = 0;
|
||||||
long numGroups = 0;
|
long numGroups = 0;
|
||||||
int numAggs = 0;
|
int numAggs = 0;
|
||||||
int numGroupCols = length(parse->groupClause);
|
int numGroupCols = list_length(parse->groupClause);
|
||||||
bool use_hashed_grouping = false;
|
bool use_hashed_grouping = false;
|
||||||
|
|
||||||
/* Preprocess targetlist in case we are inside an INSERT/UPDATE. */
|
/* 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)
|
foreach(l, parse->rowMarks)
|
||||||
{
|
{
|
||||||
Index rti = lfirsti(l);
|
Index rti = lfirst_int(l);
|
||||||
char *resname;
|
char *resname;
|
||||||
Resdom *resdom;
|
Resdom *resdom;
|
||||||
Var *var;
|
Var *var;
|
||||||
|
@ -680,7 +680,7 @@ grouping_planner(Query *parse, double tuple_fraction)
|
||||||
|
|
||||||
resname = (char *) palloc(32);
|
resname = (char *) palloc(32);
|
||||||
snprintf(resname, 32, "ctid%u", rti);
|
snprintf(resname, 32, "ctid%u", rti);
|
||||||
resdom = makeResdom(length(tlist) + 1,
|
resdom = makeResdom(list_length(tlist) + 1,
|
||||||
TIDOID,
|
TIDOID,
|
||||||
-1,
|
-1,
|
||||||
resname,
|
resname,
|
||||||
|
@ -1421,7 +1421,7 @@ make_subplanTargetList(Query *parse,
|
||||||
sub_tlist = flatten_tlist(tlist);
|
sub_tlist = flatten_tlist(tlist);
|
||||||
extravars = pull_var_clause(parse->havingQual, false);
|
extravars = pull_var_clause(parse->havingQual, false);
|
||||||
sub_tlist = add_to_flat_tlist(sub_tlist, extravars);
|
sub_tlist = add_to_flat_tlist(sub_tlist, extravars);
|
||||||
freeList(extravars);
|
list_free(extravars);
|
||||||
*need_tlist_eval = false; /* only eval if not flat tlist */
|
*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
|
* already), and make an array showing where the group columns are in
|
||||||
* the sub_tlist.
|
* the sub_tlist.
|
||||||
*/
|
*/
|
||||||
numCols = length(parse->groupClause);
|
numCols = list_length(parse->groupClause);
|
||||||
if (numCols > 0)
|
if (numCols > 0)
|
||||||
{
|
{
|
||||||
int keyno = 0;
|
int keyno = 0;
|
||||||
|
@ -1456,7 +1456,7 @@ make_subplanTargetList(Query *parse,
|
||||||
}
|
}
|
||||||
if (!sl)
|
if (!sl)
|
||||||
{
|
{
|
||||||
te = makeTargetEntry(makeResdom(length(sub_tlist) + 1,
|
te = makeTargetEntry(makeResdom(list_length(sub_tlist) + 1,
|
||||||
exprType(groupexpr),
|
exprType(groupexpr),
|
||||||
exprTypmod(groupexpr),
|
exprTypmod(groupexpr),
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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;
|
pitem->abslevel = abslevel;
|
||||||
|
|
||||||
PlannerParamList = lappend(PlannerParamList, pitem);
|
PlannerParamList = lappend(PlannerParamList, pitem);
|
||||||
i = length(PlannerParamList) - 1;
|
i = list_length(PlannerParamList) - 1;
|
||||||
|
|
||||||
retval = makeNode(Param);
|
retval = makeNode(Param);
|
||||||
retval->paramkind = PARAM_EXEC;
|
retval->paramkind = PARAM_EXEC;
|
||||||
|
@ -216,7 +216,7 @@ generate_new_param(Oid paramtype, int32 paramtypmod)
|
||||||
|
|
||||||
retval = makeNode(Param);
|
retval = makeNode(Param);
|
||||||
retval->paramkind = PARAM_EXEC;
|
retval->paramkind = PARAM_EXEC;
|
||||||
retval->paramid = (AttrNumber) length(PlannerParamList);
|
retval->paramid = (AttrNumber) list_length(PlannerParamList);
|
||||||
retval->paramtype = paramtype;
|
retval->paramtype = paramtype;
|
||||||
|
|
||||||
pitem = (PlannerParamItem *) palloc(sizeof(PlannerParamItem));
|
pitem = (PlannerParamItem *) palloc(sizeof(PlannerParamItem));
|
||||||
|
@ -320,10 +320,10 @@ make_subplan(SubLink *slink, List *lefthand, bool isTopQual)
|
||||||
tmpset = bms_copy(plan->extParam);
|
tmpset = bms_copy(plan->extParam);
|
||||||
while ((paramid = bms_first_member(tmpset)) >= 0)
|
while ((paramid = bms_first_member(tmpset)) >= 0)
|
||||||
{
|
{
|
||||||
PlannerParamItem *pitem = nth(paramid, PlannerParamList);
|
PlannerParamItem *pitem = list_nth(PlannerParamList, paramid);
|
||||||
|
|
||||||
if (pitem->abslevel == PlannerQueryLevel)
|
if (pitem->abslevel == PlannerQueryLevel)
|
||||||
node->parParam = lappendi(node->parParam, paramid);
|
node->parParam = lappend_int(node->parParam, paramid);
|
||||||
}
|
}
|
||||||
bms_free(tmpset);
|
bms_free(tmpset);
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ make_subplan(SubLink *slink, List *lefthand, bool isTopQual)
|
||||||
Param *prm;
|
Param *prm;
|
||||||
|
|
||||||
prm = generate_new_param(BOOLOID, -1);
|
prm = generate_new_param(BOOLOID, -1);
|
||||||
node->setParam = makeListi1(prm->paramid);
|
node->setParam = list_make1_int(prm->paramid);
|
||||||
PlannerInitPlan = lappend(PlannerInitPlan, node);
|
PlannerInitPlan = lappend(PlannerInitPlan, node);
|
||||||
result = (Node *) prm;
|
result = (Node *) prm;
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,7 @@ make_subplan(SubLink *slink, List *lefthand, bool isTopQual)
|
||||||
|
|
||||||
Assert(!te->resdom->resjunk);
|
Assert(!te->resdom->resjunk);
|
||||||
prm = generate_new_param(te->resdom->restype, te->resdom->restypmod);
|
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);
|
PlannerInitPlan = lappend(PlannerInitPlan, node);
|
||||||
result = (Node *) prm;
|
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",
|
elog(ERROR, "could not find array type for datatype %s",
|
||||||
format_type_be(te->resdom->restype));
|
format_type_be(te->resdom->restype));
|
||||||
prm = generate_new_param(arraytype, -1);
|
prm = generate_new_param(arraytype, -1);
|
||||||
node->setParam = makeListi1(prm->paramid);
|
node->setParam = list_make1_int(prm->paramid);
|
||||||
PlannerInitPlan = lappend(PlannerInitPlan, node);
|
PlannerInitPlan = lappend(PlannerInitPlan, node);
|
||||||
result = (Node *) prm;
|
result = (Node *) prm;
|
||||||
}
|
}
|
||||||
|
@ -382,7 +382,7 @@ make_subplan(SubLink *slink, List *lefthand, bool isTopQual)
|
||||||
plan->targetlist,
|
plan->targetlist,
|
||||||
0,
|
0,
|
||||||
&node->paramIds);
|
&node->paramIds);
|
||||||
node->setParam = listCopy(node->paramIds);
|
node->setParam = list_copy(node->paramIds);
|
||||||
PlannerInitPlan = lappend(PlannerInitPlan, node);
|
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
|
* outer plan's expression tree; they are not kept in the initplan
|
||||||
* node.
|
* node.
|
||||||
*/
|
*/
|
||||||
if (length(exprs) > 1)
|
if (list_length(exprs) > 1)
|
||||||
result = (Node *) (node->useOr ? make_orclause(exprs) :
|
result = (Node *) (node->useOr ? make_orclause(exprs) :
|
||||||
make_andclause(exprs));
|
make_andclause(exprs));
|
||||||
else
|
else
|
||||||
|
@ -473,7 +473,7 @@ make_subplan(SubLink *slink, List *lefthand, bool isTopQual)
|
||||||
args = NIL;
|
args = NIL;
|
||||||
foreach(l, node->parParam)
|
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
|
* 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)
|
foreach(l, operOids)
|
||||||
{
|
{
|
||||||
Oid opid = lfirsto(l);
|
Oid opid = lfirst_oid(l);
|
||||||
Node *leftop = (Node *) lfirst(lefthand_item);
|
Node *leftop = (Node *) lfirst(lefthand_item);
|
||||||
TargetEntry *te = (TargetEntry *) lfirst(tlist_item);
|
TargetEntry *te = (TargetEntry *) lfirst(tlist_item);
|
||||||
Node *rightop;
|
Node *rightop;
|
||||||
|
@ -547,7 +547,7 @@ convert_sublink_opers(List *lefthand, List *operOids,
|
||||||
prm = generate_new_param(te->resdom->restype,
|
prm = generate_new_param(te->resdom->restype,
|
||||||
te->resdom->restypmod);
|
te->resdom->restypmod);
|
||||||
/* Record its ID */
|
/* Record its ID */
|
||||||
*righthandIds = lappendi(*righthandIds, prm->paramid);
|
*righthandIds = lappend_int(*righthandIds, prm->paramid);
|
||||||
rightop = (Node *) prm;
|
rightop = (Node *) prm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ subplan_is_hashable(SubLink *slink, SubPlan *node)
|
||||||
*/
|
*/
|
||||||
if (slink->subLinkType != ANY_SUBLINK)
|
if (slink->subLinkType != ANY_SUBLINK)
|
||||||
return false;
|
return false;
|
||||||
if (length(slink->operName) != 1 ||
|
if (list_length(slink->operName) != 1 ||
|
||||||
strcmp(strVal(linitial(slink->operName)), "=") != 0)
|
strcmp(strVal(linitial(slink->operName)), "=") != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -640,7 +640,7 @@ subplan_is_hashable(SubLink *slink, SubPlan *node)
|
||||||
*/
|
*/
|
||||||
foreach(l, slink->operOids)
|
foreach(l, slink->operOids)
|
||||||
{
|
{
|
||||||
Oid opid = lfirsto(l);
|
Oid opid = lfirst_oid(l);
|
||||||
HeapTuple tup;
|
HeapTuple tup;
|
||||||
Form_pg_operator optup;
|
Form_pg_operator optup;
|
||||||
|
|
||||||
|
@ -691,7 +691,7 @@ convert_IN_to_join(Query *parse, SubLink *sublink)
|
||||||
*/
|
*/
|
||||||
if (sublink->subLinkType != ANY_SUBLINK)
|
if (sublink->subLinkType != ANY_SUBLINK)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (length(sublink->operName) != 1 ||
|
if (list_length(sublink->operName) != 1 ||
|
||||||
strcmp(strVal(linitial(sublink->operName)), "=") != 0)
|
strcmp(strVal(linitial(sublink->operName)), "=") != 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -731,7 +731,7 @@ convert_IN_to_join(Query *parse, SubLink *sublink)
|
||||||
makeAlias("IN_subquery", NIL),
|
makeAlias("IN_subquery", NIL),
|
||||||
false);
|
false);
|
||||||
parse->rtable = lappend(parse->rtable, rte);
|
parse->rtable = lappend(parse->rtable, rte);
|
||||||
rtindex = length(parse->rtable);
|
rtindex = list_length(parse->rtable);
|
||||||
rtr = makeNode(RangeTblRef);
|
rtr = makeNode(RangeTblRef);
|
||||||
rtr->rtindex = rtindex;
|
rtr->rtindex = rtindex;
|
||||||
parse->jointree->fromlist = lappend(parse->jointree->fromlist, rtr);
|
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),
|
newarg = process_sublinks_mutator(lfirst(l),
|
||||||
(void *) &locTopQual);
|
(void *) &locTopQual);
|
||||||
if (and_clause(newarg))
|
if (and_clause(newarg))
|
||||||
newargs = nconc(newargs, ((BoolExpr *) newarg)->args);
|
newargs = list_concat(newargs, ((BoolExpr *) newarg)->args);
|
||||||
else
|
else
|
||||||
newargs = lappend(newargs, newarg);
|
newargs = lappend(newargs, newarg);
|
||||||
}
|
}
|
||||||
|
@ -896,7 +896,7 @@ process_sublinks_mutator(Node *node, bool *isTopQual)
|
||||||
newarg = process_sublinks_mutator(lfirst(l),
|
newarg = process_sublinks_mutator(lfirst(l),
|
||||||
(void *) &locTopQual);
|
(void *) &locTopQual);
|
||||||
if (or_clause(newarg))
|
if (or_clause(newarg))
|
||||||
newargs = nconc(newargs, ((BoolExpr *) newarg)->args);
|
newargs = list_concat(newargs, ((BoolExpr *) newarg)->args);
|
||||||
else
|
else
|
||||||
newargs = lappend(newargs, newarg);
|
newargs = lappend(newargs, newarg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* Adjust level-0 varnos in subquery so that we can append its
|
||||||
* rangetable to upper query's.
|
* rangetable to upper query's.
|
||||||
*/
|
*/
|
||||||
rtoffset = length(parse->rtable);
|
rtoffset = list_length(parse->rtable);
|
||||||
OffsetVarNodes((Node *) subquery, rtoffset, 0);
|
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
|
* hold off until after fixing the upper rtable entries; no
|
||||||
* point in running that code on the subquery ones too.)
|
* 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
|
* Pull up any FOR UPDATE markers, too. (OffsetVarNodes
|
||||||
* already adjusted the marker values, so just nconc the
|
* already adjusted the marker values, so just list_concat
|
||||||
* list.)
|
* 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
|
* 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.
|
* And now append any subquery InClauseInfos to our list.
|
||||||
*/
|
*/
|
||||||
parse->in_info_list = nconc(parse->in_info_list,
|
parse->in_info_list = list_concat(parse->in_info_list,
|
||||||
subquery->in_info_list);
|
subquery->in_info_list);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Miscellaneous housekeeping.
|
* Miscellaneous housekeeping.
|
||||||
|
@ -662,7 +662,7 @@ reduce_outer_joins_pass2(Node *jtnode,
|
||||||
pass_nonnullable = bms_add_members(pass_nonnullable,
|
pass_nonnullable = bms_add_members(pass_nonnullable,
|
||||||
nonnullable_rels);
|
nonnullable_rels);
|
||||||
/* And recurse --- but only into interesting subtrees */
|
/* 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)
|
forboth(l, f->fromlist, s, state->sub_states)
|
||||||
{
|
{
|
||||||
reduce_outer_joins_state *sub_state = lfirst(s);
|
reduce_outer_joins_state *sub_state = lfirst(s);
|
||||||
|
@ -919,20 +919,20 @@ simplify_jointree(Query *parse, Node *jtnode)
|
||||||
* from_collapse_limit.
|
* from_collapse_limit.
|
||||||
*/
|
*/
|
||||||
FromExpr *subf = (FromExpr *) child;
|
FromExpr *subf = (FromExpr *) child;
|
||||||
int childlen = length(subf->fromlist);
|
int childlen = list_length(subf->fromlist);
|
||||||
int myothers = length(newlist) + children_remaining;
|
int myothers = list_length(newlist) + children_remaining;
|
||||||
|
|
||||||
if (childlen <= 1 ||
|
if (childlen <= 1 ||
|
||||||
(childlen + myothers) <= from_collapse_limit)
|
(childlen + myothers) <= from_collapse_limit)
|
||||||
{
|
{
|
||||||
newlist = nconc(newlist, subf->fromlist);
|
newlist = list_concat(newlist, subf->fromlist);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* By now, the quals have been converted to
|
* By now, the quals have been converted to
|
||||||
* implicit-AND lists, so we just need to join the
|
* implicit-AND lists, so we just need to join the
|
||||||
* lists. NOTE: we put the pulled-up quals first.
|
* 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);
|
(List *) f->quals);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -963,11 +963,11 @@ simplify_jointree(Query *parse, Node *jtnode)
|
||||||
rightlen;
|
rightlen;
|
||||||
|
|
||||||
if (j->larg && IsA(j->larg, FromExpr))
|
if (j->larg && IsA(j->larg, FromExpr))
|
||||||
leftlen = length(((FromExpr *) j->larg)->fromlist);
|
leftlen = list_length(((FromExpr *) j->larg)->fromlist);
|
||||||
else
|
else
|
||||||
leftlen = 1;
|
leftlen = 1;
|
||||||
if (j->rarg && IsA(j->rarg, FromExpr))
|
if (j->rarg && IsA(j->rarg, FromExpr))
|
||||||
rightlen = length(((FromExpr *) j->rarg)->fromlist);
|
rightlen = list_length(((FromExpr *) j->rarg)->fromlist);
|
||||||
else
|
else
|
||||||
rightlen = 1;
|
rightlen = 1;
|
||||||
if ((leftlen + rightlen) <= join_collapse_limit)
|
if ((leftlen + rightlen) <= join_collapse_limit)
|
||||||
|
@ -985,22 +985,22 @@ simplify_jointree(Query *parse, Node *jtnode)
|
||||||
f->quals = subf->quals;
|
f->quals = subf->quals;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
f->fromlist = makeList1(j->larg);
|
f->fromlist = list_make1(j->larg);
|
||||||
|
|
||||||
if (j->rarg && IsA(j->rarg, FromExpr))
|
if (j->rarg && IsA(j->rarg, FromExpr))
|
||||||
{
|
{
|
||||||
FromExpr *subf = (FromExpr *) j->rarg;
|
FromExpr *subf = (FromExpr *) j->rarg;
|
||||||
|
|
||||||
f->fromlist = nconc(f->fromlist,
|
f->fromlist = list_concat(f->fromlist,
|
||||||
subf->fromlist);
|
subf->fromlist);
|
||||||
f->quals = (Node *) nconc((List *) f->quals,
|
f->quals = (Node *) list_concat((List *) f->quals,
|
||||||
(List *) subf->quals);
|
(List *) subf->quals);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
f->fromlist = lappend(f->fromlist, j->rarg);
|
f->fromlist = lappend(f->fromlist, j->rarg);
|
||||||
|
|
||||||
/* pulled-up quals first */
|
/* pulled-up quals first */
|
||||||
f->quals = (Node *) nconc((List *) f->quals,
|
f->quals = (Node *) list_concat((List *) f->quals,
|
||||||
(List *) j->quals);
|
(List *) j->quals);
|
||||||
|
|
||||||
return (Node *) f;
|
return (Node *) f;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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)
|
if (orlist == NIL)
|
||||||
return NULL; /* probably can't happen */
|
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);
|
return linitial(orlist);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -461,7 +461,7 @@ process_duplicate_ors(List *orlist)
|
||||||
if (and_clause((Node *) clause))
|
if (and_clause((Node *) clause))
|
||||||
{
|
{
|
||||||
List *subclauses = ((BoolExpr *) clause)->args;
|
List *subclauses = ((BoolExpr *) clause)->args;
|
||||||
int nclauses = length(subclauses);
|
int nclauses = list_length(subclauses);
|
||||||
|
|
||||||
if (reference == NIL || nclauses < num_subclauses)
|
if (reference == NIL || nclauses < num_subclauses)
|
||||||
{
|
{
|
||||||
|
@ -471,7 +471,7 @@ process_duplicate_ors(List *orlist)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
reference = makeList1(clause);
|
reference = list_make1(clause);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -479,7 +479,7 @@ process_duplicate_ors(List *orlist)
|
||||||
/*
|
/*
|
||||||
* Just in case, eliminate any duplicates in the reference list.
|
* 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
|
* 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 (and_clause((Node *) clause))
|
||||||
{
|
{
|
||||||
if (!member(refclause, ((BoolExpr *) clause)->args))
|
if (!list_member(((BoolExpr *) clause)->args, refclause))
|
||||||
{
|
{
|
||||||
win = false;
|
win = false;
|
||||||
break;
|
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
|
* (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.
|
* 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.
|
* a winning clause in an AND sub-clause will be removed automatically.
|
||||||
*/
|
*/
|
||||||
neworlist = NIL;
|
neworlist = NIL;
|
||||||
|
@ -543,10 +543,10 @@ process_duplicate_ors(List *orlist)
|
||||||
{
|
{
|
||||||
List *subclauses = ((BoolExpr *) clause)->args;
|
List *subclauses = ((BoolExpr *) clause)->args;
|
||||||
|
|
||||||
subclauses = set_difference(subclauses, winners);
|
subclauses = list_difference(subclauses, winners);
|
||||||
if (subclauses != NIL)
|
if (subclauses != NIL)
|
||||||
{
|
{
|
||||||
if (length(subclauses) == 1)
|
if (list_length(subclauses) == 1)
|
||||||
neworlist = lappend(neworlist, linitial(subclauses));
|
neworlist = lappend(neworlist, linitial(subclauses));
|
||||||
else
|
else
|
||||||
neworlist = lappend(neworlist, make_andclause(subclauses));
|
neworlist = lappend(neworlist, make_andclause(subclauses));
|
||||||
|
@ -559,7 +559,7 @@ process_duplicate_ors(List *orlist)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!member(clause, winners))
|
if (!list_member(winners, clause))
|
||||||
neworlist = lappend(neworlist, clause);
|
neworlist = lappend(neworlist, clause);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -577,7 +577,7 @@ process_duplicate_ors(List *orlist)
|
||||||
*/
|
*/
|
||||||
if (neworlist != NIL)
|
if (neworlist != NIL)
|
||||||
{
|
{
|
||||||
if (length(neworlist) == 1)
|
if (list_length(neworlist) == 1)
|
||||||
winners = lappend(winners, linitial(neworlist));
|
winners = lappend(winners, linitial(neworlist));
|
||||||
else
|
else
|
||||||
winners = lappend(winners, make_orclause(pull_ors(neworlist)));
|
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
|
* And return the constructed AND clause, again being wary of a single
|
||||||
* element and AND/OR flatness.
|
* element and AND/OR flatness.
|
||||||
*/
|
*/
|
||||||
if (length(winners) == 1)
|
if (list_length(winners) == 1)
|
||||||
return (Expr *) linitial(winners);
|
return (Expr *) linitial(winners);
|
||||||
else
|
else
|
||||||
return make_andclause(pull_ands(winners));
|
return make_andclause(pull_ands(winners));
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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;
|
Resdom *resdom;
|
||||||
Var *var;
|
Var *var;
|
||||||
|
|
||||||
resdom = makeResdom(length(tlist) + 1,
|
resdom = makeResdom(list_length(tlist) + 1,
|
||||||
TIDOID,
|
TIDOID,
|
||||||
-1,
|
-1,
|
||||||
pstrdup("ctid"),
|
pstrdup("ctid"),
|
||||||
|
@ -94,7 +94,7 @@ preprocess_targetlist(List *tlist,
|
||||||
* modify the original tlist (is this really necessary?).
|
* modify the original tlist (is this really necessary?).
|
||||||
*/
|
*/
|
||||||
if (command_type == CMD_DELETE)
|
if (command_type == CMD_DELETE)
|
||||||
tlist = listCopy(tlist);
|
tlist = list_copy(tlist);
|
||||||
|
|
||||||
tlist = lappend(tlist, makeTargetEntry(resdom, (Expr *) var));
|
tlist = lappend(tlist, makeTargetEntry(resdom, (Expr *) var));
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* generate only one Append and Sort for the lot. Recurse to find
|
||||||
* such nodes and compute their children's plans.
|
* such nodes and compute their children's plans.
|
||||||
*/
|
*/
|
||||||
planlist = nconc(recurse_union_children(op->larg, parse,
|
planlist = list_concat(recurse_union_children(op->larg, parse,
|
||||||
op, refnames_tlist),
|
op, refnames_tlist),
|
||||||
recurse_union_children(op->rarg, parse,
|
recurse_union_children(op->rarg, parse,
|
||||||
op, refnames_tlist));
|
op, refnames_tlist));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate tlist for Append plan node.
|
* Generate tlist for Append plan node.
|
||||||
|
@ -303,7 +303,7 @@ generate_nonunion_plan(SetOperationStmt *op, Query *parse,
|
||||||
op->colTypes, false, 1,
|
op->colTypes, false, 1,
|
||||||
refnames_tlist,
|
refnames_tlist,
|
||||||
&child_sortclauses);
|
&child_sortclauses);
|
||||||
planlist = makeList2(lplan, rplan);
|
planlist = list_make2(lplan, rplan);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate tlist for Append plan node.
|
* Generate tlist for Append plan node.
|
||||||
|
@ -349,7 +349,7 @@ generate_nonunion_plan(SetOperationStmt *op, Query *parse,
|
||||||
cmd = SETOPCMD_INTERSECT; /* keep compiler quiet */
|
cmd = SETOPCMD_INTERSECT; /* keep compiler quiet */
|
||||||
break;
|
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;
|
*sortClauses = sortList;
|
||||||
|
|
||||||
|
@ -375,15 +375,15 @@ recurse_union_children(Node *setOp, Query *parse,
|
||||||
|
|
||||||
if (op->op == top_union->op &&
|
if (op->op == top_union->op &&
|
||||||
(op->all == top_union->all || op->all) &&
|
(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 */
|
/* Same UNION, so fold children into parent's subplan list */
|
||||||
return nconc(recurse_union_children(op->larg, parse,
|
return list_concat(recurse_union_children(op->larg, parse,
|
||||||
top_union,
|
top_union,
|
||||||
refnames_tlist),
|
refnames_tlist),
|
||||||
recurse_union_children(op->rarg, parse,
|
recurse_union_children(op->rarg, parse,
|
||||||
top_union,
|
top_union,
|
||||||
refnames_tlist));
|
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
|
* we have an EXCEPT or INTERSECT as child, else there won't be
|
||||||
* resjunk anyway.
|
* resjunk anyway.
|
||||||
*/
|
*/
|
||||||
return makeList1(recurse_set_operations(setOp, parse,
|
return list_make1(recurse_set_operations(setOp, parse,
|
||||||
top_union->colTypes, false,
|
top_union->colTypes, false,
|
||||||
-1, refnames_tlist,
|
-1, refnames_tlist,
|
||||||
&child_sortclauses));
|
&child_sortclauses));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -430,7 +430,7 @@ generate_setop_tlist(List *colTypes, int flag,
|
||||||
k = list_head(refnames_tlist);
|
k = list_head(refnames_tlist);
|
||||||
foreach(i, colTypes)
|
foreach(i, colTypes)
|
||||||
{
|
{
|
||||||
Oid colType = lfirsto(i);
|
Oid colType = lfirst_oid(i);
|
||||||
TargetEntry *inputtle = (TargetEntry *) lfirst(j);
|
TargetEntry *inputtle = (TargetEntry *) lfirst(j);
|
||||||
TargetEntry *reftle = (TargetEntry *) lfirst(k);
|
TargetEntry *reftle = (TargetEntry *) lfirst(k);
|
||||||
int32 colTypmod;
|
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
|
* 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.)
|
* 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)
|
foreach(planl, input_plans)
|
||||||
{
|
{
|
||||||
|
@ -577,7 +577,7 @@ generate_append_tlist(List *colTypes, bool flag,
|
||||||
colindex = 0;
|
colindex = 0;
|
||||||
forboth(curColType, colTypes, ref_tl_item, refnames_tlist)
|
forboth(curColType, colTypes, ref_tl_item, refnames_tlist)
|
||||||
{
|
{
|
||||||
Oid colType = lfirsto(curColType);
|
Oid colType = lfirst_oid(curColType);
|
||||||
int32 colTypmod = colTypmods[colindex++];
|
int32 colTypmod = colTypmods[colindex++];
|
||||||
TargetEntry *reftle = (TargetEntry *) lfirst(ref_tl_item);
|
TargetEntry *reftle = (TargetEntry *) lfirst(ref_tl_item);
|
||||||
|
|
||||||
|
@ -663,7 +663,7 @@ List *
|
||||||
find_all_inheritors(Oid parentrel)
|
find_all_inheritors(Oid parentrel)
|
||||||
{
|
{
|
||||||
List *examined_relids = NIL;
|
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
|
* While the queue of unexamined relids is nonempty, remove the first
|
||||||
|
@ -676,7 +676,7 @@ find_all_inheritors(Oid parentrel)
|
||||||
List *currentchildren;
|
List *currentchildren;
|
||||||
|
|
||||||
unexamined_relids = list_delete_first(unexamined_relids);
|
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);
|
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
|
* into an infinite loop, though theoretically there can't be any
|
||||||
* cycles in the inheritance graph anyway.)
|
* cycles in the inheritance graph anyway.)
|
||||||
*/
|
*/
|
||||||
currentchildren = set_differenceo(currentchildren, examined_relids);
|
currentchildren = list_difference_oid(currentchildren, examined_relids);
|
||||||
unexamined_relids = set_uniono(unexamined_relids, currentchildren);
|
unexamined_relids = list_union_oid(unexamined_relids, currentchildren);
|
||||||
}
|
}
|
||||||
|
|
||||||
return examined_relids;
|
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
|
* case. This could happen despite above has_subclass() check, if
|
||||||
* table once had a child but no longer does.
|
* table once had a child but no longer does.
|
||||||
*/
|
*/
|
||||||
if (length(inhOIDs) < 2)
|
if (list_length(inhOIDs) < 2)
|
||||||
return NIL;
|
return NIL;
|
||||||
/* OK, it's an inheritance set; expand it */
|
/* OK, it's an inheritance set; expand it */
|
||||||
if (dup_parent)
|
if (dup_parent)
|
||||||
inhRTIs = NIL;
|
inhRTIs = NIL;
|
||||||
else
|
else
|
||||||
inhRTIs = makeListi1(rti); /* include original RTE in result */
|
inhRTIs = list_make1_int(rti); /* include original RTE in result */
|
||||||
|
|
||||||
foreach(l, inhOIDs)
|
foreach(l, inhOIDs)
|
||||||
{
|
{
|
||||||
Oid childOID = lfirsto(l);
|
Oid childOID = lfirst_oid(l);
|
||||||
RangeTblEntry *childrte;
|
RangeTblEntry *childrte;
|
||||||
Index childRTindex;
|
Index childRTindex;
|
||||||
|
|
||||||
|
@ -771,9 +771,9 @@ expand_inherited_rtentry(Query *parse, Index rti, bool dup_parent)
|
||||||
childrte = copyObject(rte);
|
childrte = copyObject(rte);
|
||||||
childrte->relid = childOID;
|
childrte->relid = childOID;
|
||||||
parse->rtable = lappend(parse->rtable, childrte);
|
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;
|
return inhRTIs;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
|
@ -96,9 +96,9 @@ make_opclause(Oid opno, Oid opresulttype, bool opretset,
|
||||||
expr->opresulttype = opresulttype;
|
expr->opresulttype = opresulttype;
|
||||||
expr->opretset = opretset;
|
expr->opretset = opretset;
|
||||||
if (rightop)
|
if (rightop)
|
||||||
expr->args = makeList2(leftop, rightop);
|
expr->args = list_make2(leftop, rightop);
|
||||||
else
|
else
|
||||||
expr->args = makeList1(leftop);
|
expr->args = list_make1(leftop);
|
||||||
return (Expr *) expr;
|
return (Expr *) expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ make_notclause(Expr *notclause)
|
||||||
BoolExpr *expr = makeNode(BoolExpr);
|
BoolExpr *expr = makeNode(BoolExpr);
|
||||||
|
|
||||||
expr->boolop = NOT_EXPR;
|
expr->boolop = NOT_EXPR;
|
||||||
expr->args = makeList1(notclause);
|
expr->args = list_make1(notclause);
|
||||||
return (Expr *) expr;
|
return (Expr *) expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ make_and_qual(Node *qual1, Node *qual2)
|
||||||
return qual2;
|
return qual2;
|
||||||
if (qual2 == NULL)
|
if (qual2 == NULL)
|
||||||
return qual1;
|
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)
|
if (andclauses == NIL)
|
||||||
return (Expr *) makeBoolConst(true, false);
|
return (Expr *) makeBoolConst(true, false);
|
||||||
else if (length(andclauses) == 1)
|
else if (list_length(andclauses) == 1)
|
||||||
return (Expr *) linitial(andclauses);
|
return (Expr *) linitial(andclauses);
|
||||||
else
|
else
|
||||||
return make_andclause(andclauses);
|
return make_andclause(andclauses);
|
||||||
|
@ -302,7 +302,7 @@ make_ands_implicit(Expr *clause)
|
||||||
DatumGetBool(((Const *) clause)->constvalue))
|
DatumGetBool(((Const *) clause)->constvalue))
|
||||||
return NIL; /* constant TRUE input -> NIL list */
|
return NIL; /* constant TRUE input -> NIL list */
|
||||||
else
|
else
|
||||||
return makeList1(clause);
|
return list_make1(clause);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -599,7 +599,7 @@ contain_mutable_functions_walker(Node *node, void *context)
|
||||||
|
|
||||||
foreach(opid, sublink->operOids)
|
foreach(opid, sublink->operOids)
|
||||||
{
|
{
|
||||||
if (op_volatile(lfirsto(opid)) != PROVOLATILE_IMMUTABLE)
|
if (op_volatile(lfirst_oid(opid)) != PROVOLATILE_IMMUTABLE)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/* else fall through to check args */
|
/* else fall through to check args */
|
||||||
|
@ -682,7 +682,7 @@ contain_volatile_functions_walker(Node *node, void *context)
|
||||||
|
|
||||||
foreach(opid, sublink->operOids)
|
foreach(opid, sublink->operOids)
|
||||||
{
|
{
|
||||||
if (op_volatile(lfirsto(opid)) == PROVOLATILE_VOLATILE)
|
if (op_volatile(lfirst_oid(opid)) == PROVOLATILE_VOLATILE)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/* else fall through to check args */
|
/* else fall through to check args */
|
||||||
|
@ -982,7 +982,7 @@ CommuteClause(OpExpr *clause)
|
||||||
|
|
||||||
/* Sanity checks: caller is at fault if these fail */
|
/* Sanity checks: caller is at fault if these fail */
|
||||||
if (!is_opclause(clause) ||
|
if (!is_opclause(clause) ||
|
||||||
length(clause->args) != 2)
|
list_length(clause->args) != 2)
|
||||||
elog(ERROR, "cannot commute non-binary-operator clause");
|
elog(ERROR, "cannot commute non-binary-operator clause");
|
||||||
|
|
||||||
opoid = get_commutator(clause->opno);
|
opoid = get_commutator(clause->opno);
|
||||||
|
@ -1281,7 +1281,7 @@ eval_const_expressions_mutator(Node *node, List *active_fns)
|
||||||
if (newargs == NIL)
|
if (newargs == NIL)
|
||||||
return makeBoolConst(false, false);
|
return makeBoolConst(false, false);
|
||||||
/* If only one nonconst-or-NULL input, it's the result */
|
/* If only one nonconst-or-NULL input, it's the result */
|
||||||
if (length(newargs) == 1)
|
if (list_length(newargs) == 1)
|
||||||
return (Node *) linitial(newargs);
|
return (Node *) linitial(newargs);
|
||||||
/* Else we still need an OR node */
|
/* Else we still need an OR node */
|
||||||
return (Node *) make_orclause(newargs);
|
return (Node *) make_orclause(newargs);
|
||||||
|
@ -1302,13 +1302,13 @@ eval_const_expressions_mutator(Node *node, List *active_fns)
|
||||||
if (newargs == NIL)
|
if (newargs == NIL)
|
||||||
return makeBoolConst(true, false);
|
return makeBoolConst(true, false);
|
||||||
/* If only one nonconst-or-NULL input, it's the result */
|
/* If only one nonconst-or-NULL input, it's the result */
|
||||||
if (length(newargs) == 1)
|
if (list_length(newargs) == 1)
|
||||||
return (Node *) linitial(newargs);
|
return (Node *) linitial(newargs);
|
||||||
/* Else we still need an AND node */
|
/* Else we still need an AND node */
|
||||||
return (Node *) make_andclause(newargs);
|
return (Node *) make_andclause(newargs);
|
||||||
}
|
}
|
||||||
case NOT_EXPR:
|
case NOT_EXPR:
|
||||||
Assert(length(args) == 1);
|
Assert(list_length(args) == 1);
|
||||||
if (IsA(linitial(args), Const))
|
if (IsA(linitial(args), Const))
|
||||||
{
|
{
|
||||||
Const *const_input = (Const *) linitial(args);
|
Const *const_input = (Const *) linitial(args);
|
||||||
|
@ -1570,8 +1570,8 @@ eval_const_expressions_mutator(Node *node, List *active_fns)
|
||||||
RowExpr *rowexpr = (RowExpr *) arg;
|
RowExpr *rowexpr = (RowExpr *) arg;
|
||||||
|
|
||||||
if (fselect->fieldnum > 0 &&
|
if (fselect->fieldnum > 0 &&
|
||||||
fselect->fieldnum <= length(rowexpr->args))
|
fselect->fieldnum <= list_length(rowexpr->args))
|
||||||
return (Node *) nth(fselect->fieldnum - 1, rowexpr->args);
|
return (Node *) list_nth(rowexpr->args, fselect->fieldnum - 1);
|
||||||
}
|
}
|
||||||
newfselect = makeNode(FieldSelect);
|
newfselect = makeNode(FieldSelect);
|
||||||
newfselect->arg = (Expr *) arg;
|
newfselect->arg = (Expr *) arg;
|
||||||
|
@ -1640,9 +1640,9 @@ simplify_or_arguments(List *args, bool *haveNull, bool *forceTrue)
|
||||||
}
|
}
|
||||||
else if (or_clause(arg))
|
else if (or_clause(arg))
|
||||||
{
|
{
|
||||||
newargs = nconc(newargs,
|
newargs = list_concat(newargs,
|
||||||
simplify_or_arguments(((BoolExpr *) arg)->args,
|
simplify_or_arguments(((BoolExpr *) arg)->args,
|
||||||
haveNull, forceTrue));
|
haveNull, forceTrue));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1701,9 +1701,9 @@ simplify_and_arguments(List *args, bool *haveNull, bool *forceFalse)
|
||||||
}
|
}
|
||||||
else if (and_clause(arg))
|
else if (and_clause(arg))
|
||||||
{
|
{
|
||||||
newargs = nconc(newargs,
|
newargs = list_concat(newargs,
|
||||||
simplify_and_arguments(((BoolExpr *) arg)->args,
|
simplify_and_arguments(((BoolExpr *) arg)->args,
|
||||||
haveNull, forceFalse));
|
haveNull, forceFalse));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1880,11 +1880,11 @@ inline_function(Oid funcid, Oid result_type, List *args,
|
||||||
if (funcform->prolang != SQLlanguageId ||
|
if (funcform->prolang != SQLlanguageId ||
|
||||||
funcform->prosecdef ||
|
funcform->prosecdef ||
|
||||||
funcform->proretset ||
|
funcform->proretset ||
|
||||||
funcform->pronargs != length(args))
|
funcform->pronargs != list_length(args))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Check for recursive function, and give up trying to expand if so */
|
/* 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;
|
return NULL;
|
||||||
|
|
||||||
/* Check permission to call function (fail later, if not) */
|
/* 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)
|
argtypes[i] == ANYELEMENTOID)
|
||||||
{
|
{
|
||||||
polymorphic = true;
|
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.
|
* more than one command in the function body.
|
||||||
*/
|
*/
|
||||||
raw_parsetree_list = pg_parse_query(src);
|
raw_parsetree_list = pg_parse_query(src);
|
||||||
if (length(raw_parsetree_list) != 1)
|
if (list_length(raw_parsetree_list) != 1)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
querytree_list = parse_analyze(linitial(raw_parsetree_list),
|
querytree_list = parse_analyze(linitial(raw_parsetree_list),
|
||||||
argtypes, funcform->pronargs);
|
argtypes, funcform->pronargs);
|
||||||
|
|
||||||
if (length(querytree_list) != 1)
|
if (list_length(querytree_list) != 1)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
querytree = (Query *) linitial(querytree_list);
|
querytree = (Query *) linitial(querytree_list);
|
||||||
|
@ -1973,7 +1973,7 @@ inline_function(Oid funcid, Oid result_type, List *args,
|
||||||
querytree->limitOffset ||
|
querytree->limitOffset ||
|
||||||
querytree->limitCount ||
|
querytree->limitCount ||
|
||||||
querytree->setOperations ||
|
querytree->setOperations ||
|
||||||
length(querytree->targetList) != 1)
|
list_length(querytree->targetList) != 1)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
newexpr = (Node *) ((TargetEntry *) linitial(querytree->targetList))->expr;
|
newexpr = (Node *) ((TargetEntry *) linitial(querytree->targetList))->expr;
|
||||||
|
@ -2048,7 +2048,7 @@ inline_function(Oid funcid, Oid result_type, List *args,
|
||||||
*/
|
*/
|
||||||
if (contain_subplans(param))
|
if (contain_subplans(param))
|
||||||
goto fail;
|
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 >
|
if (eval_cost.startup + eval_cost.per_tuple >
|
||||||
10 * cpu_operator_cost)
|
10 * cpu_operator_cost)
|
||||||
goto fail;
|
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.
|
* add the current function to the context list of active functions.
|
||||||
*/
|
*/
|
||||||
newexpr = eval_const_expressions_mutator(newexpr,
|
newexpr = eval_const_expressions_mutator(newexpr,
|
||||||
lconso(funcid, active_fns));
|
lcons_oid(funcid, active_fns));
|
||||||
|
|
||||||
error_context_stack = sqlerrcontext.previous;
|
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 */
|
/* 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) */
|
/* 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,
|
return expression_tree_mutator(node, substitute_actual_parameters_mutator,
|
||||||
(void *) context);
|
(void *) context);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* Remove the restrictinfo from the list. Pointer comparison is
|
||||||
* sufficient.
|
* sufficient.
|
||||||
*/
|
*/
|
||||||
Assert(ptrMember(restrictinfo, joininfo->jinfo_restrictinfo));
|
Assert(list_member_ptr(joininfo->jinfo_restrictinfo, restrictinfo));
|
||||||
joininfo->jinfo_restrictinfo = lremove(restrictinfo,
|
joininfo->jinfo_restrictinfo = list_delete_ptr(joininfo->jinfo_restrictinfo,
|
||||||
joininfo->jinfo_restrictinfo);
|
restrictinfo);
|
||||||
bms_free(unjoined_relids);
|
bms_free(unjoined_relids);
|
||||||
}
|
}
|
||||||
bms_free(tmprelids);
|
bms_free(tmprelids);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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,
|
* We are making a pathnode for a single-scan indexscan; therefore,
|
||||||
* indexinfo etc should be single-element lists.
|
* indexinfo etc should be single-element lists.
|
||||||
*/
|
*/
|
||||||
pathnode->indexinfo = makeList1(index);
|
pathnode->indexinfo = list_make1(index);
|
||||||
pathnode->indexclauses = makeList1(restriction_clauses);
|
pathnode->indexclauses = list_make1(restriction_clauses);
|
||||||
pathnode->indexquals = makeList1(indexquals);
|
pathnode->indexquals = list_make1(indexquals);
|
||||||
|
|
||||||
/* It's not an innerjoin path. */
|
/* It's not an innerjoin path. */
|
||||||
pathnode->isjoininner = false;
|
pathnode->isjoininner = false;
|
||||||
|
@ -686,12 +686,12 @@ create_unique_path(Query *root, RelOptInfo *rel, Path *subpath)
|
||||||
if (sub_targetlist)
|
if (sub_targetlist)
|
||||||
{
|
{
|
||||||
pathnode->rows = estimate_num_groups(root, sub_targetlist, rel->rows);
|
pathnode->rows = estimate_num_groups(root, sub_targetlist, rel->rows);
|
||||||
numCols = length(sub_targetlist);
|
numCols = list_length(sub_targetlist);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pathnode->rows = rel->rows;
|
pathnode->rows = rel->rows;
|
||||||
numCols = length(FastListValue(&rel->reltargetlist));
|
numCols = list_length(FastListValue(&rel->reltargetlist));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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)
|
foreach(l, indexoidlist)
|
||||||
{
|
{
|
||||||
Oid indexoid = lfirsto(l);
|
Oid indexoid = lfirst_oid(l);
|
||||||
Relation indexRelation;
|
Relation indexRelation;
|
||||||
Form_pg_index index;
|
Form_pg_index index;
|
||||||
IndexOptInfo *info;
|
IndexOptInfo *info;
|
||||||
|
@ -158,7 +158,7 @@ get_relation_info(Oid relationObjectId, RelOptInfo *rel)
|
||||||
indexinfos = lcons(info, indexinfos);
|
indexinfos = lcons(info, indexinfos);
|
||||||
}
|
}
|
||||||
|
|
||||||
freeList(indexoidlist);
|
list_free(indexoidlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
rel->indexlist = indexinfos;
|
rel->indexlist = indexinfos;
|
||||||
|
@ -338,7 +338,7 @@ find_inheritance_children(Oid inhparent)
|
||||||
while ((inheritsTuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
|
while ((inheritsTuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
|
||||||
{
|
{
|
||||||
inhrelid = ((Form_pg_inherits) GETSTRUCT(inheritsTuple))->inhrelid;
|
inhrelid = ((Form_pg_inherits) GETSTRUCT(inheritsTuple))->inhrelid;
|
||||||
list = lappendo(list, inhrelid);
|
list = lappend_oid(list, inhrelid);
|
||||||
}
|
}
|
||||||
heap_endscan(scan);
|
heap_endscan(scan);
|
||||||
heap_close(relation, AccessShareLock);
|
heap_close(relation, AccessShareLock);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 */
|
/* Subquery or function --- need only set up attr range */
|
||||||
/* Note: 0 is included in range to support whole-row Vars */
|
/* Note: 0 is included in range to support whole-row Vars */
|
||||||
rel->min_attr = 0;
|
rel->min_attr = 0;
|
||||||
rel->max_attr = length(rte->eref->colnames);
|
rel->max_attr = list_length(rte->eref->colnames);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "unrecognized RTE kind: %d",
|
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.
|
* Collect all the clauses that syntactically belong at this level.
|
||||||
*/
|
*/
|
||||||
rlist = nconc(subbuild_joinrel_restrictlist(joinrel,
|
rlist = list_concat(subbuild_joinrel_restrictlist(joinrel,
|
||||||
outer_rel->joininfo),
|
outer_rel->joininfo),
|
||||||
subbuild_joinrel_restrictlist(joinrel,
|
subbuild_joinrel_restrictlist(joinrel,
|
||||||
inner_rel->joininfo));
|
inner_rel->joininfo));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Eliminate duplicate and redundant clauses.
|
* Eliminate duplicate and redundant clauses.
|
||||||
|
@ -462,7 +462,7 @@ build_joinrel_restrictlist(Query *root,
|
||||||
*/
|
*/
|
||||||
result = remove_redundant_join_clauses(root, rlist, jointype);
|
result = remove_redundant_join_clauses(root, rlist, jointype);
|
||||||
|
|
||||||
freeList(rlist);
|
list_free(rlist);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -496,8 +496,8 @@ subbuild_joinrel_restrictlist(RelOptInfo *joinrel,
|
||||||
* We must copy the list to avoid disturbing the input relation,
|
* We must copy the list to avoid disturbing the input relation,
|
||||||
* but we can use a shallow copy.
|
* but we can use a shallow copy.
|
||||||
*/
|
*/
|
||||||
restrictlist = nconc(restrictlist,
|
restrictlist = list_concat(restrictlist,
|
||||||
listCopy(joininfo->jinfo_restrictinfo));
|
list_copy(joininfo->jinfo_restrictinfo));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -549,8 +549,8 @@ subbuild_joinrel_joinlist(RelOptInfo *joinrel,
|
||||||
|
|
||||||
new_joininfo = make_joininfo_node(joinrel, new_unjoined_relids);
|
new_joininfo = make_joininfo_node(joinrel, new_unjoined_relids);
|
||||||
new_joininfo->jinfo_restrictinfo =
|
new_joininfo->jinfo_restrictinfo =
|
||||||
set_ptrUnion(new_joininfo->jinfo_restrictinfo,
|
list_union_ptr(new_joininfo->jinfo_restrictinfo,
|
||||||
joininfo->jinfo_restrictinfo);
|
joininfo->jinfo_restrictinfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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)
|
if (indexclauses == NIL)
|
||||||
return NIL;
|
return NIL;
|
||||||
/* If single indexscan, just return the ANDed clauses */
|
/* If single indexscan, just return the ANDed clauses */
|
||||||
if (length(indexclauses) == 1)
|
if (list_length(indexclauses) == 1)
|
||||||
return (List *) linitial(indexclauses);
|
return (List *) linitial(indexclauses);
|
||||||
/* Else we need an OR RestrictInfo structure */
|
/* Else we need an OR RestrictInfo structure */
|
||||||
foreach(orlist, indexclauses)
|
foreach(orlist, indexclauses)
|
||||||
|
@ -112,7 +112,7 @@ make_restrictinfo_from_indexclauses(List *indexclauses,
|
||||||
andlist = get_actual_clauses(andlist);
|
andlist = get_actual_clauses(andlist);
|
||||||
withoutris = lappend(withoutris, make_ands_explicit(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),
|
make_orclause(withris),
|
||||||
is_pushed_down,
|
is_pushed_down,
|
||||||
valid_everywhere));
|
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.
|
* If it's a binary opclause, set up left/right relids info.
|
||||||
* In any case set up the total clause 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->left_relids = pull_varnos(get_leftop(clause));
|
||||||
restrictinfo->right_relids = pull_varnos(get_rightop(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))
|
else if (CLAUSECOST(rinfo) < CLAUSECOST(prevrinfo))
|
||||||
{
|
{
|
||||||
/* keep this one, drop the previous one */
|
/* keep this one, drop the previous one */
|
||||||
result = lremove(prevrinfo, result);
|
result = list_delete_ptr(result, prevrinfo);
|
||||||
result = lappend(result, rinfo);
|
result = lappend(result, rinfo);
|
||||||
}
|
}
|
||||||
/* else, drop this one */
|
/* else, drop this one */
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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;
|
List *new_tlist;
|
||||||
|
|
||||||
new_tlist = add_to_flat_tlist(NIL, vlist);
|
new_tlist = add_to_flat_tlist(NIL, vlist);
|
||||||
freeList(vlist);
|
list_free(vlist);
|
||||||
return new_tlist;
|
return new_tlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ flatten_tlist(List *tlist)
|
||||||
List *
|
List *
|
||||||
add_to_flat_tlist(List *tlist, List *vars)
|
add_to_flat_tlist(List *tlist, List *vars)
|
||||||
{
|
{
|
||||||
int next_resdomno = length(tlist) + 1;
|
int next_resdomno = list_length(tlist) + 1;
|
||||||
ListCell *v;
|
ListCell *v;
|
||||||
|
|
||||||
foreach(v, vars)
|
foreach(v, vars)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 */
|
/* Expand join alias reference */
|
||||||
Assert(var->varattno > 0);
|
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,
|
* If we are expanding an alias carried down from an upper query,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* 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);
|
release_pstate_resources(pstate);
|
||||||
|
|
||||||
foreach(l, extras_before)
|
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);
|
result = lappend(result, query);
|
||||||
|
|
||||||
foreach(l, extras_after)
|
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
|
* Make sure that only the original query is marked original. We have
|
||||||
|
@ -592,7 +592,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt,
|
||||||
true);
|
true);
|
||||||
rtr = makeNode(RangeTblRef);
|
rtr = makeNode(RangeTblRef);
|
||||||
/* assume new rte is at end */
|
/* 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));
|
Assert(rte == rt_fetch(rtr->rtindex, pstate->p_rtable));
|
||||||
pstate->p_joinlist = lappend(pstate->p_joinlist, rtr);
|
pstate->p_joinlist = lappend(pstate->p_joinlist, rtr);
|
||||||
|
|
||||||
|
@ -674,7 +674,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt,
|
||||||
Assert(IsA(col, ResTarget));
|
Assert(IsA(col, ResTarget));
|
||||||
|
|
||||||
Assert(!tle->resdom->resjunk);
|
Assert(!tle->resdom->resjunk);
|
||||||
updateTargetListEntry(pstate, tle, col->name, lfirsti(attnos),
|
updateTargetListEntry(pstate, tle, col->name, lfirst_int(attnos),
|
||||||
col->indirection);
|
col->indirection);
|
||||||
|
|
||||||
icols = lnext(icols);
|
icols = lnext(icols);
|
||||||
|
@ -874,8 +874,8 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt,
|
||||||
q->utilityStmt = (Node *) stmt;
|
q->utilityStmt = (Node *) stmt;
|
||||||
stmt->tableElts = cxt.columns;
|
stmt->tableElts = cxt.columns;
|
||||||
stmt->constraints = cxt.ckconstraints;
|
stmt->constraints = cxt.ckconstraints;
|
||||||
*extras_before = nconc(*extras_before, cxt.blist);
|
*extras_before = list_concat(*extras_before, cxt.blist);
|
||||||
*extras_after = nconc(cxt.alist, *extras_after);
|
*extras_after = list_concat(cxt.alist, *extras_after);
|
||||||
|
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
@ -893,7 +893,7 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
|
||||||
|
|
||||||
/* Check for SERIAL pseudo-types */
|
/* Check for SERIAL pseudo-types */
|
||||||
is_serial = false;
|
is_serial = false;
|
||||||
if (length(column->typename->names) == 1)
|
if (list_length(column->typename->names) == 1)
|
||||||
{
|
{
|
||||||
char *typname = strVal(linitial(column->typename->names));
|
char *typname = strVal(linitial(column->typename->names));
|
||||||
|
|
||||||
|
@ -969,7 +969,7 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
|
||||||
snamenode->val.val.str = qstring;
|
snamenode->val.val.str = qstring;
|
||||||
funccallnode = makeNode(FuncCall);
|
funccallnode = makeNode(FuncCall);
|
||||||
funccallnode->funcname = SystemFuncName("nextval");
|
funccallnode->funcname = SystemFuncName("nextval");
|
||||||
funccallnode->args = makeList1(snamenode);
|
funccallnode->args = list_make1(snamenode);
|
||||||
funccallnode->agg_star = false;
|
funccallnode->agg_star = false;
|
||||||
funccallnode->agg_distinct = false;
|
funccallnode->agg_distinct = false;
|
||||||
|
|
||||||
|
@ -1004,7 +1004,7 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
|
||||||
{
|
{
|
||||||
FkConstraint *fkconstraint = (FkConstraint *) constraint;
|
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);
|
cxt->fkconstraints = lappend(cxt->fkconstraints, fkconstraint);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1049,7 +1049,7 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
|
||||||
NULL,
|
NULL,
|
||||||
"pkey");
|
"pkey");
|
||||||
if (constraint->keys == NIL)
|
if (constraint->keys == NIL)
|
||||||
constraint->keys = makeList1(makeString(column->colname));
|
constraint->keys = list_make1(makeString(column->colname));
|
||||||
cxt->ixconstraints = lappend(cxt->ixconstraints, constraint);
|
cxt->ixconstraints = lappend(cxt->ixconstraints, constraint);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1059,7 +1059,7 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
|
||||||
column->colname,
|
column->colname,
|
||||||
"key");
|
"key");
|
||||||
if (constraint->keys == NIL)
|
if (constraint->keys == NIL)
|
||||||
constraint->keys = makeList1(makeString(column->colname));
|
constraint->keys = list_make1(makeString(column->colname));
|
||||||
cxt->ixconstraints = lappend(cxt->ixconstraints, constraint);
|
cxt->ixconstraints = lappend(cxt->ixconstraints, constraint);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1437,7 +1437,7 @@ transformIndexConstraints(ParseState *pstate, CreateStmtContext *cxt)
|
||||||
if (cxt->pkey != NULL)
|
if (cxt->pkey != NULL)
|
||||||
{
|
{
|
||||||
/* Make sure we keep the PKEY index in preference to others... */
|
/* 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)
|
foreach(l, indexlist)
|
||||||
|
@ -1679,7 +1679,7 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt,
|
||||||
stmt->whereClause = transformWhereClause(pstate, stmt->whereClause,
|
stmt->whereClause = transformWhereClause(pstate, stmt->whereClause,
|
||||||
"WHERE");
|
"WHERE");
|
||||||
|
|
||||||
if (length(pstate->p_rtable) != 2) /* naughty, naughty... */
|
if (list_length(pstate->p_rtable) != 2) /* naughty, naughty... */
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||||
errmsg("rule WHERE condition may not contain references to other relations")));
|
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->rtable = pstate->p_rtable;
|
||||||
nothing_qry->jointree = makeFromExpr(NIL, NULL); /* no join wanted */
|
nothing_qry->jointree = makeFromExpr(NIL, NULL); /* no join wanted */
|
||||||
|
|
||||||
stmt->actions = makeList1(nothing_qry);
|
stmt->actions = list_make1(nothing_qry);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2062,7 +2062,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
|
||||||
|
|
||||||
foreach(dtlist, sostmt->colTypes)
|
foreach(dtlist, sostmt->colTypes)
|
||||||
{
|
{
|
||||||
Oid colType = lfirsto(dtlist);
|
Oid colType = lfirst_oid(dtlist);
|
||||||
Resdom *leftResdom;
|
Resdom *leftResdom;
|
||||||
char *colName;
|
char *colName;
|
||||||
Resdom *resdom;
|
Resdom *resdom;
|
||||||
|
@ -2123,10 +2123,10 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
|
||||||
jrtr->rtindex = 1; /* only entry in dummy rtable */
|
jrtr->rtindex = 1; /* only entry in dummy rtable */
|
||||||
|
|
||||||
sv_rtable = pstate->p_rtable;
|
sv_rtable = pstate->p_rtable;
|
||||||
pstate->p_rtable = makeList1(jrte);
|
pstate->p_rtable = list_make1(jrte);
|
||||||
|
|
||||||
sv_namespace = pstate->p_namespace;
|
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
|
* 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
|
* selecting an output column by name or number. Enforce by checking
|
||||||
* that transformSortClause doesn't add any items to tlist.
|
* that transformSortClause doesn't add any items to tlist.
|
||||||
*/
|
*/
|
||||||
tllen = length(qry->targetList);
|
tllen = list_length(qry->targetList);
|
||||||
|
|
||||||
qry->sortClause = transformSortClause(pstate,
|
qry->sortClause = transformSortClause(pstate,
|
||||||
sortClause,
|
sortClause,
|
||||||
|
@ -2144,7 +2144,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
|
||||||
pstate->p_namespace = sv_namespace;
|
pstate->p_namespace = sv_namespace;
|
||||||
pstate->p_rtable = sv_rtable;
|
pstate->p_rtable = sv_rtable;
|
||||||
|
|
||||||
if (tllen != length(qry->targetList))
|
if (tllen != list_length(qry->targetList))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
errmsg("ORDER BY on a UNION/INTERSECT/EXCEPT result must be on one of the result columns")));
|
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);
|
selectList = parse_sub_analyze((Node *) stmt, pstate);
|
||||||
|
|
||||||
Assert(length(selectList) == 1);
|
Assert(list_length(selectList) == 1);
|
||||||
selectQuery = (Query *) linitial(selectList);
|
selectQuery = (Query *) linitial(selectList);
|
||||||
Assert(IsA(selectQuery, Query));
|
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.
|
* Make the leaf query be a subquery in the top-level rangetable.
|
||||||
*/
|
*/
|
||||||
snprintf(selectName, sizeof(selectName), "*SELECT* %d",
|
snprintf(selectName, sizeof(selectName), "*SELECT* %d",
|
||||||
length(pstate->p_rtable) + 1);
|
list_length(pstate->p_rtable) + 1);
|
||||||
rte = addRangeTableEntryForSubquery(pstate,
|
rte = addRangeTableEntryForSubquery(pstate,
|
||||||
selectQuery,
|
selectQuery,
|
||||||
makeAlias(selectName, NIL),
|
makeAlias(selectName, NIL),
|
||||||
|
@ -2265,7 +2265,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt)
|
||||||
*/
|
*/
|
||||||
rtr = makeNode(RangeTblRef);
|
rtr = makeNode(RangeTblRef);
|
||||||
/* assume new rte is at end */
|
/* 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));
|
Assert(rte == rt_fetch(rtr->rtindex, pstate->p_rtable));
|
||||||
return (Node *) rtr;
|
return (Node *) rtr;
|
||||||
}
|
}
|
||||||
|
@ -2298,7 +2298,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt)
|
||||||
*/
|
*/
|
||||||
lcoltypes = getSetColTypes(pstate, op->larg);
|
lcoltypes = getSetColTypes(pstate, op->larg);
|
||||||
rcoltypes = getSetColTypes(pstate, op->rarg);
|
rcoltypes = getSetColTypes(pstate, op->rarg);
|
||||||
if (length(lcoltypes) != length(rcoltypes))
|
if (list_length(lcoltypes) != list_length(rcoltypes))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
errmsg("each %s query must have the same number of columns",
|
errmsg("each %s query must have the same number of columns",
|
||||||
|
@ -2307,13 +2307,13 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt)
|
||||||
op->colTypes = NIL;
|
op->colTypes = NIL;
|
||||||
forboth(l, lcoltypes, r, rcoltypes)
|
forboth(l, lcoltypes, r, rcoltypes)
|
||||||
{
|
{
|
||||||
Oid lcoltype = lfirsto(l);
|
Oid lcoltype = lfirst_oid(l);
|
||||||
Oid rcoltype = lfirsto(r);
|
Oid rcoltype = lfirst_oid(r);
|
||||||
Oid rescoltype;
|
Oid rescoltype;
|
||||||
|
|
||||||
rescoltype = select_common_type(makeListo2(lcoltype, rcoltype),
|
rescoltype = select_common_type(list_make2_oid(lcoltype, rcoltype),
|
||||||
context);
|
context);
|
||||||
op->colTypes = lappendo(op->colTypes, rescoltype);
|
op->colTypes = lappend_oid(op->colTypes, rescoltype);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Node *) op;
|
return (Node *) op;
|
||||||
|
@ -2344,7 +2344,7 @@ getSetColTypes(ParseState *pstate, Node *node)
|
||||||
|
|
||||||
if (resnode->resjunk)
|
if (resnode->resjunk)
|
||||||
continue;
|
continue;
|
||||||
result = lappendo(result, resnode->restype);
|
result = lappend_oid(result, resnode->restype);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2370,7 +2370,7 @@ applyColumnNames(List *dst, List *src)
|
||||||
ListCell *dst_item = list_head(dst);
|
ListCell *dst_item = list_head(dst);
|
||||||
ListCell *src_item = list_head(src);
|
ListCell *src_item = list_head(src);
|
||||||
|
|
||||||
if (length(src) > length(dst))
|
if (list_length(src) > list_length(dst))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
errmsg("CREATE TABLE AS specifies too many column names")));
|
errmsg("CREATE TABLE AS specifies too many column names")));
|
||||||
|
@ -2632,8 +2632,8 @@ transformAlterTableStmt(ParseState *pstate, AlterTableStmt *stmt,
|
||||||
qry->commandType = CMD_UTILITY;
|
qry->commandType = CMD_UTILITY;
|
||||||
qry->utilityStmt = (Node *) stmt;
|
qry->utilityStmt = (Node *) stmt;
|
||||||
|
|
||||||
*extras_before = nconc(*extras_before, cxt.blist);
|
*extras_before = list_concat(*extras_before, cxt.blist);
|
||||||
*extras_after = nconc(cxt.alist, *extras_after);
|
*extras_after = list_concat(cxt.alist, *extras_after);
|
||||||
|
|
||||||
return qry;
|
return qry;
|
||||||
}
|
}
|
||||||
|
@ -2681,7 +2681,7 @@ transformPrepareStmt(ParseState *pstate, PrepareStmt *stmt)
|
||||||
result->utilityStmt = (Node *) stmt;
|
result->utilityStmt = (Node *) stmt;
|
||||||
|
|
||||||
/* Transform list of TypeNames to list (and array) of type OIDs */
|
/* Transform list of TypeNames to list (and array) of type OIDs */
|
||||||
nargs = length(stmt->argtypes);
|
nargs = list_length(stmt->argtypes);
|
||||||
|
|
||||||
if (nargs)
|
if (nargs)
|
||||||
{
|
{
|
||||||
|
@ -2695,7 +2695,7 @@ transformPrepareStmt(ParseState *pstate, PrepareStmt *stmt)
|
||||||
TypeName *tn = lfirst(l);
|
TypeName *tn = lfirst(l);
|
||||||
Oid toid = typenameTypeId(tn);
|
Oid toid = typenameTypeId(tn);
|
||||||
|
|
||||||
argtype_oids = lappendo(argtype_oids, toid);
|
argtype_oids = lappend_oid(argtype_oids, toid);
|
||||||
argtoids[i++] = toid;
|
argtoids[i++] = toid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2712,7 +2712,7 @@ transformPrepareStmt(ParseState *pstate, PrepareStmt *stmt)
|
||||||
* Shouldn't get any extra statements, since grammar only allows
|
* Shouldn't get any extra statements, since grammar only allows
|
||||||
* OptimizableStmt
|
* OptimizableStmt
|
||||||
*/
|
*/
|
||||||
if (length(queries) != 1)
|
if (list_length(queries) != 1)
|
||||||
elog(ERROR, "unexpected extra stuff in prepared statement");
|
elog(ERROR, "unexpected extra stuff in prepared statement");
|
||||||
|
|
||||||
stmt->query = linitial(queries);
|
stmt->query = linitial(queries);
|
||||||
|
@ -2733,8 +2733,8 @@ transformExecuteStmt(ParseState *pstate, ExecuteStmt *stmt)
|
||||||
|
|
||||||
if (stmt->params || paramtypes)
|
if (stmt->params || paramtypes)
|
||||||
{
|
{
|
||||||
int nparams = length(stmt->params);
|
int nparams = list_length(stmt->params);
|
||||||
int nexpected = length(paramtypes);
|
int nexpected = list_length(paramtypes);
|
||||||
ListCell *l, *l2;
|
ListCell *l, *l2;
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
||||||
|
@ -2749,7 +2749,7 @@ transformExecuteStmt(ParseState *pstate, ExecuteStmt *stmt)
|
||||||
forboth(l, stmt->params, l2, paramtypes)
|
forboth(l, stmt->params, l2, paramtypes)
|
||||||
{
|
{
|
||||||
Node *expr = lfirst(l);
|
Node *expr = lfirst(l);
|
||||||
Oid expected_type_id = lfirsto(l2);
|
Oid expected_type_id = lfirst_oid(l2);
|
||||||
Oid given_type_id;
|
Oid given_type_id;
|
||||||
|
|
||||||
expr = transformExpr(pstate, expr);
|
expr = transformExpr(pstate, expr);
|
||||||
|
@ -2838,8 +2838,8 @@ transformForUpdate(Query *qry, List *forUpdate)
|
||||||
switch (rte->rtekind)
|
switch (rte->rtekind)
|
||||||
{
|
{
|
||||||
case RTE_RELATION:
|
case RTE_RELATION:
|
||||||
if (!intMember(i, rowMarks)) /* avoid duplicates */
|
if (!list_member_int(rowMarks, i)) /* avoid duplicates */
|
||||||
rowMarks = lappendi(rowMarks, i);
|
rowMarks = lappend_int(rowMarks, i);
|
||||||
rte->requiredPerms |= ACL_SELECT_FOR_UPDATE;
|
rte->requiredPerms |= ACL_SELECT_FOR_UPDATE;
|
||||||
break;
|
break;
|
||||||
case RTE_SUBQUERY:
|
case RTE_SUBQUERY:
|
||||||
|
@ -2847,7 +2847,7 @@ transformForUpdate(Query *qry, List *forUpdate)
|
||||||
* FOR UPDATE of subquery is propagated to subquery's
|
* FOR UPDATE of subquery is propagated to subquery's
|
||||||
* rels
|
* rels
|
||||||
*/
|
*/
|
||||||
transformForUpdate(rte->subquery, makeList1(NULL));
|
transformForUpdate(rte->subquery, list_make1(NULL));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* ignore JOIN, SPECIAL, FUNCTION RTEs */
|
/* ignore JOIN, SPECIAL, FUNCTION RTEs */
|
||||||
|
@ -2873,8 +2873,8 @@ transformForUpdate(Query *qry, List *forUpdate)
|
||||||
switch (rte->rtekind)
|
switch (rte->rtekind)
|
||||||
{
|
{
|
||||||
case RTE_RELATION:
|
case RTE_RELATION:
|
||||||
if (!intMember(i, rowMarks)) /* avoid duplicates */
|
if (!list_member_int(rowMarks, i)) /* avoid duplicates */
|
||||||
rowMarks = lappendi(rowMarks, i);
|
rowMarks = lappend_int(rowMarks, i);
|
||||||
rte->requiredPerms |= ACL_SELECT_FOR_UPDATE;
|
rte->requiredPerms |= ACL_SELECT_FOR_UPDATE;
|
||||||
break;
|
break;
|
||||||
case RTE_SUBQUERY:
|
case RTE_SUBQUERY:
|
||||||
|
@ -2882,7 +2882,7 @@ transformForUpdate(Query *qry, List *forUpdate)
|
||||||
* FOR UPDATE of subquery is propagated to
|
* FOR UPDATE of subquery is propagated to
|
||||||
* subquery's rels
|
* subquery's rels
|
||||||
*/
|
*/
|
||||||
transformForUpdate(rte->subquery, makeList1(NULL));
|
transformForUpdate(rte->subquery, list_make1(NULL));
|
||||||
break;
|
break;
|
||||||
case RTE_JOIN:
|
case RTE_JOIN:
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
|
@ -3198,12 +3198,12 @@ analyzeCreateSchemaStmt(CreateSchemaStmt *stmt)
|
||||||
}
|
}
|
||||||
|
|
||||||
result = NIL;
|
result = NIL;
|
||||||
result = nconc(result, cxt.sequences);
|
result = list_concat(result, cxt.sequences);
|
||||||
result = nconc(result, cxt.tables);
|
result = list_concat(result, cxt.tables);
|
||||||
result = nconc(result, cxt.views);
|
result = list_concat(result, cxt.views);
|
||||||
result = nconc(result, cxt.indexes);
|
result = list_concat(result, cxt.indexes);
|
||||||
result = nconc(result, cxt.triggers);
|
result = list_concat(result, cxt.triggers);
|
||||||
result = nconc(result, cxt.grants);
|
result = list_concat(result, cxt.grants);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
|
@ -480,7 +480,7 @@ stmtmulti: stmtmulti ';' stmt
|
||||||
}
|
}
|
||||||
| stmt
|
| stmt
|
||||||
{ if ($1 != NULL)
|
{ if ($1 != NULL)
|
||||||
$$ = makeList1($1);
|
$$ = list_make1($1);
|
||||||
else
|
else
|
||||||
$$ = NIL;
|
$$ = NIL;
|
||||||
}
|
}
|
||||||
|
@ -693,7 +693,7 @@ OptUserElem:
|
||||||
;
|
;
|
||||||
|
|
||||||
user_list: user_list ',' UserId { $$ = lappend($1, makeString($3)); }
|
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);
|
VariableSetStmt *n = makeNode(VariableSetStmt);
|
||||||
n->name = "timezone";
|
n->name = "timezone";
|
||||||
if ($3 != NULL)
|
if ($3 != NULL)
|
||||||
n->args = makeList1($3);
|
n->args = list_make1($3);
|
||||||
$$ = n;
|
$$ = n;
|
||||||
}
|
}
|
||||||
| TRANSACTION transaction_mode_list
|
| TRANSACTION transaction_mode_list
|
||||||
|
@ -900,14 +900,14 @@ set_rest: var_name TO var_list_or_default
|
||||||
VariableSetStmt *n = makeNode(VariableSetStmt);
|
VariableSetStmt *n = makeNode(VariableSetStmt);
|
||||||
n->name = "client_encoding";
|
n->name = "client_encoding";
|
||||||
if ($2 != NULL)
|
if ($2 != NULL)
|
||||||
n->args = makeList1(makeStringConst($2, NULL));
|
n->args = list_make1(makeStringConst($2, NULL));
|
||||||
$$ = n;
|
$$ = n;
|
||||||
}
|
}
|
||||||
| SESSION AUTHORIZATION ColId_or_Sconst
|
| SESSION AUTHORIZATION ColId_or_Sconst
|
||||||
{
|
{
|
||||||
VariableSetStmt *n = makeNode(VariableSetStmt);
|
VariableSetStmt *n = makeNode(VariableSetStmt);
|
||||||
n->name = "session_authorization";
|
n->name = "session_authorization";
|
||||||
n->args = makeList1(makeStringConst($3, NULL));
|
n->args = list_make1(makeStringConst($3, NULL));
|
||||||
$$ = n;
|
$$ = n;
|
||||||
}
|
}
|
||||||
| SESSION AUTHORIZATION DEFAULT
|
| SESSION AUTHORIZATION DEFAULT
|
||||||
|
@ -937,7 +937,7 @@ var_list_or_default:
|
||||||
| DEFAULT { $$ = NIL; }
|
| DEFAULT { $$ = NIL; }
|
||||||
;
|
;
|
||||||
|
|
||||||
var_list: var_value { $$ = makeList1($1); }
|
var_list: var_value { $$ = list_make1($1); }
|
||||||
| var_list ',' var_value { $$ = lappend($1, $3); }
|
| var_list ',' var_value { $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -1153,7 +1153,7 @@ AlterTableStmt:
|
||||||
;
|
;
|
||||||
|
|
||||||
alter_table_cmds:
|
alter_table_cmds:
|
||||||
alter_table_cmd { $$ = makeList1($1); }
|
alter_table_cmd { $$ = list_make1($1); }
|
||||||
| alter_table_cmds ',' alter_table_cmd { $$ = lappend($1, $3); }
|
| 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)
|
if ($8)
|
||||||
n->options = lappend(n->options, $8);
|
n->options = lappend(n->options, $8);
|
||||||
if ($10)
|
if ($10)
|
||||||
n->options = nconc(n->options, $10);
|
n->options = list_concat(n->options, $10);
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
@ -1479,7 +1479,7 @@ CreateStmt: CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')'
|
||||||
$4->istemp = $2;
|
$4->istemp = $2;
|
||||||
n->relation = $4;
|
n->relation = $4;
|
||||||
n->tableElts = $8;
|
n->tableElts = $8;
|
||||||
n->inhRelations = makeList1($6);
|
n->inhRelations = list_make1($6);
|
||||||
n->constraints = NIL;
|
n->constraints = NIL;
|
||||||
n->hasoids = $10;
|
n->hasoids = $10;
|
||||||
n->oncommit = $11;
|
n->oncommit = $11;
|
||||||
|
@ -1511,7 +1511,7 @@ OptTableElementList:
|
||||||
TableElementList:
|
TableElementList:
|
||||||
TableElement
|
TableElement
|
||||||
{
|
{
|
||||||
$$ = makeList1($1);
|
$$ = list_make1($1);
|
||||||
}
|
}
|
||||||
| TableElementList ',' TableElement
|
| TableElementList ',' TableElement
|
||||||
{
|
{
|
||||||
|
@ -1814,7 +1814,7 @@ opt_column_list:
|
||||||
;
|
;
|
||||||
|
|
||||||
columnList:
|
columnList:
|
||||||
columnElem { $$ = makeList1($1); }
|
columnElem { $$ = list_make1($1); }
|
||||||
| columnList ',' columnElem { $$ = lappend($1, $3); }
|
| columnList ',' columnElem { $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -1941,7 +1941,7 @@ OptCreateAs:
|
||||||
;
|
;
|
||||||
|
|
||||||
CreateAsList:
|
CreateAsList:
|
||||||
CreateAsElement { $$ = makeList1($1); }
|
CreateAsElement { $$ = list_make1($1); }
|
||||||
| CreateAsList ',' CreateAsElement { $$ = lappend($1, $3); }
|
| CreateAsList ',' CreateAsElement { $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -2099,7 +2099,7 @@ opt_trusted:
|
||||||
*/
|
*/
|
||||||
handler_name:
|
handler_name:
|
||||||
name
|
name
|
||||||
{ $$ = makeList1(makeString($1)); }
|
{ $$ = list_make1(makeString($1)); }
|
||||||
| dotted_name { $$ = $1; }
|
| dotted_name { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -2236,7 +2236,7 @@ TriggerForType:
|
||||||
;
|
;
|
||||||
|
|
||||||
TriggerFuncArgs:
|
TriggerFuncArgs:
|
||||||
TriggerFuncArg { $$ = makeList1($1); }
|
TriggerFuncArg { $$ = list_make1($1); }
|
||||||
| TriggerFuncArgs ',' TriggerFuncArg { $$ = lappend($1, $3); }
|
| TriggerFuncArgs ',' TriggerFuncArg { $$ = lappend($1, $3); }
|
||||||
| /*EMPTY*/ { $$ = NIL; }
|
| /*EMPTY*/ { $$ = NIL; }
|
||||||
;
|
;
|
||||||
|
@ -2328,7 +2328,7 @@ CreateAssertStmt:
|
||||||
{
|
{
|
||||||
CreateTrigStmt *n = makeNode(CreateTrigStmt);
|
CreateTrigStmt *n = makeNode(CreateTrigStmt);
|
||||||
n->trigname = $3;
|
n->trigname = $3;
|
||||||
n->args = makeList1($6);
|
n->args = list_make1($6);
|
||||||
n->isconstraint = TRUE;
|
n->isconstraint = TRUE;
|
||||||
n->deferrable = ($8 & 1) != 0;
|
n->deferrable = ($8 & 1) != 0;
|
||||||
n->initdeferred = ($8 & 2) != 0;
|
n->initdeferred = ($8 & 2) != 0;
|
||||||
|
@ -2395,7 +2395,7 @@ DefineStmt:
|
||||||
RangeVar *r = makeNode(RangeVar);
|
RangeVar *r = makeNode(RangeVar);
|
||||||
|
|
||||||
/* can't use qualified_name, sigh */
|
/* can't use qualified_name, sigh */
|
||||||
switch (length($3))
|
switch (list_length($3))
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
r->catalogname = NULL;
|
r->catalogname = NULL;
|
||||||
|
@ -2428,7 +2428,7 @@ DefineStmt:
|
||||||
definition: '(' def_list ')' { $$ = $2; }
|
definition: '(' def_list ')' { $$ = $2; }
|
||||||
;
|
;
|
||||||
|
|
||||||
def_list: def_elem { $$ = makeList1($1); }
|
def_list: def_elem { $$ = list_make1($1); }
|
||||||
| def_list ',' def_elem { $$ = lappend($1, $3); }
|
| def_list ',' def_elem { $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -2473,7 +2473,7 @@ CreateOpClassStmt:
|
||||||
;
|
;
|
||||||
|
|
||||||
opclass_item_list:
|
opclass_item_list:
|
||||||
opclass_item { $$ = makeList1($1); }
|
opclass_item { $$ = list_make1($1); }
|
||||||
| opclass_item_list ',' opclass_item { $$ = lappend($1, $3); }
|
| opclass_item_list ',' opclass_item { $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -2566,11 +2566,11 @@ drop_type: TABLE { $$ = OBJECT_TABLE; }
|
||||||
;
|
;
|
||||||
|
|
||||||
any_name_list:
|
any_name_list:
|
||||||
any_name { $$ = makeList1($1); }
|
any_name { $$ = list_make1($1); }
|
||||||
| any_name_list ',' any_name { $$ = lappend($1, $3); }
|
| any_name_list ',' any_name { $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
any_name: ColId { $$ = makeList1(makeString($1)); }
|
any_name: ColId { $$ = list_make1(makeString($1)); }
|
||||||
| dotted_name { $$ = $1; }
|
| dotted_name { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -2623,7 +2623,7 @@ CommentStmt:
|
||||||
CommentStmt *n = makeNode(CommentStmt);
|
CommentStmt *n = makeNode(CommentStmt);
|
||||||
n->objtype = OBJECT_AGGREGATE;
|
n->objtype = OBJECT_AGGREGATE;
|
||||||
n->objname = $4;
|
n->objname = $4;
|
||||||
n->objargs = makeList1($6);
|
n->objargs = list_make1($6);
|
||||||
n->comment = $9;
|
n->comment = $9;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
}
|
}
|
||||||
|
@ -2669,7 +2669,7 @@ CommentStmt:
|
||||||
/* Obsolete syntax supported for awhile for compatibility */
|
/* Obsolete syntax supported for awhile for compatibility */
|
||||||
CommentStmt *n = makeNode(CommentStmt);
|
CommentStmt *n = makeNode(CommentStmt);
|
||||||
n->objtype = OBJECT_RULE;
|
n->objtype = OBJECT_RULE;
|
||||||
n->objname = makeList1(makeString($4));
|
n->objname = list_make1(makeString($4));
|
||||||
n->objargs = NIL;
|
n->objargs = NIL;
|
||||||
n->comment = $6;
|
n->comment = $6;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
|
@ -2688,7 +2688,7 @@ CommentStmt:
|
||||||
CommentStmt *n = makeNode(CommentStmt);
|
CommentStmt *n = makeNode(CommentStmt);
|
||||||
n->objtype = OBJECT_OPCLASS;
|
n->objtype = OBJECT_OPCLASS;
|
||||||
n->objname = $5;
|
n->objname = $5;
|
||||||
n->objargs = makeList1(makeString($7));
|
n->objargs = list_make1(makeString($7));
|
||||||
n->comment = $9;
|
n->comment = $9;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
}
|
}
|
||||||
|
@ -2696,7 +2696,7 @@ CommentStmt:
|
||||||
{
|
{
|
||||||
CommentStmt *n = makeNode(CommentStmt);
|
CommentStmt *n = makeNode(CommentStmt);
|
||||||
n->objtype = OBJECT_LARGEOBJECT;
|
n->objtype = OBJECT_LARGEOBJECT;
|
||||||
n->objname = makeList1($5);
|
n->objname = list_make1($5);
|
||||||
n->objargs = NIL;
|
n->objargs = NIL;
|
||||||
n->comment = $7;
|
n->comment = $7;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
|
@ -2705,8 +2705,8 @@ CommentStmt:
|
||||||
{
|
{
|
||||||
CommentStmt *n = makeNode(CommentStmt);
|
CommentStmt *n = makeNode(CommentStmt);
|
||||||
n->objtype = OBJECT_CAST;
|
n->objtype = OBJECT_CAST;
|
||||||
n->objname = makeList1($5);
|
n->objname = list_make1($5);
|
||||||
n->objargs = makeList1($7);
|
n->objargs = list_make1($7);
|
||||||
n->comment = $10;
|
n->comment = $10;
|
||||||
$$ = (Node *) n;
|
$$ = (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 */
|
/* either ALL [PRIVILEGES] or a list of individual privileges */
|
||||||
privileges: privilege_list { $$ = $1; }
|
privileges: privilege_list { $$ = $1; }
|
||||||
| ALL { $$ = makeListi1(ACL_ALL_RIGHTS); }
|
| ALL { $$ = list_make1_int(ACL_ALL_RIGHTS); }
|
||||||
| ALL PRIVILEGES { $$ = makeListi1(ACL_ALL_RIGHTS); }
|
| ALL PRIVILEGES { $$ = list_make1_int(ACL_ALL_RIGHTS); }
|
||||||
;
|
;
|
||||||
|
|
||||||
privilege_list:
|
privilege_list:
|
||||||
privilege { $$ = makeListi1($1); }
|
privilege { $$ = list_make1_int($1); }
|
||||||
| privilege_list ',' privilege { $$ = lappendi($1, $3); }
|
| privilege_list ',' privilege { $$ = lappend_int($1, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Not all of these privilege types apply to all objects, but that
|
/* Not all of these privilege types apply to all objects, but that
|
||||||
|
@ -3013,7 +3013,7 @@ privilege_target:
|
||||||
|
|
||||||
|
|
||||||
grantee_list:
|
grantee_list:
|
||||||
grantee { $$ = makeList1($1); }
|
grantee { $$ = list_make1($1); }
|
||||||
| grantee_list ',' grantee { $$ = lappend($1, $3); }
|
| grantee_list ',' grantee { $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -3054,7 +3054,7 @@ opt_revoke_grant_option:
|
||||||
|
|
||||||
|
|
||||||
function_with_argtypes_list:
|
function_with_argtypes_list:
|
||||||
function_with_argtypes { $$ = makeList1($1); }
|
function_with_argtypes { $$ = list_make1($1); }
|
||||||
| function_with_argtypes_list ',' function_with_argtypes
|
| function_with_argtypes_list ',' function_with_argtypes
|
||||||
{ $$ = lappend($1, $3); }
|
{ $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
@ -3103,7 +3103,7 @@ access_method_clause:
|
||||||
| /*EMPTY*/ { $$ = DEFAULT_INDEX_TYPE; }
|
| /*EMPTY*/ { $$ = DEFAULT_INDEX_TYPE; }
|
||||||
;
|
;
|
||||||
|
|
||||||
index_params: index_elem { $$ = makeList1($1); }
|
index_params: index_elem { $$ = list_make1($1); }
|
||||||
| index_params ',' index_elem { $$ = lappend($1, $3); }
|
| index_params ',' index_elem { $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -3182,7 +3182,7 @@ func_args: '(' func_args_list ')' { $$ = $2; }
|
||||||
;
|
;
|
||||||
|
|
||||||
func_args_list:
|
func_args_list:
|
||||||
func_arg { $$ = makeList1($1); }
|
func_arg { $$ = list_make1($1); }
|
||||||
| func_args_list ',' func_arg { $$ = lappend($1, $3); }
|
| func_args_list ',' func_arg { $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -3259,7 +3259,7 @@ func_type: Typename { $$ = $1; }
|
||||||
|
|
||||||
createfunc_opt_list:
|
createfunc_opt_list:
|
||||||
/* Must be at least one to prevent conflict */
|
/* 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); }
|
| 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
|
| 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.")));
|
errhint("Use NONE to denote the missing argument of a unary operator.")));
|
||||||
}
|
}
|
||||||
| Typename ',' Typename
|
| Typename ',' Typename
|
||||||
{ $$ = makeList2($1, $3); }
|
{ $$ = list_make2($1, $3); }
|
||||||
| NONE ',' Typename /* left unary */
|
| NONE ',' Typename /* left unary */
|
||||||
{ $$ = makeList2(NULL, $3); }
|
{ $$ = list_make2(NULL, $3); }
|
||||||
| Typename ',' NONE /* right unary */
|
| Typename ',' NONE /* right unary */
|
||||||
{ $$ = makeList2($1, NULL); }
|
{ $$ = list_make2($1, NULL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
any_operator:
|
any_operator:
|
||||||
all_Op
|
all_Op
|
||||||
{ $$ = makeList1(makeString($1)); }
|
{ $$ = list_make1(makeString($1)); }
|
||||||
| ColId '.' any_operator
|
| ColId '.' any_operator
|
||||||
{ $$ = lcons(makeString($1), $3); }
|
{ $$ = lcons(makeString($1), $3); }
|
||||||
;
|
;
|
||||||
|
@ -3495,7 +3495,7 @@ RenameStmt: ALTER AGGREGATE func_name '(' aggr_argtype ')' RENAME TO name
|
||||||
RenameStmt *n = makeNode(RenameStmt);
|
RenameStmt *n = makeNode(RenameStmt);
|
||||||
n->renameType = OBJECT_AGGREGATE;
|
n->renameType = OBJECT_AGGREGATE;
|
||||||
n->object = $3;
|
n->object = $3;
|
||||||
n->objarg = makeList1($5);
|
n->objarg = list_make1($5);
|
||||||
n->newname = $9;
|
n->newname = $9;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
|
@ -3625,7 +3625,7 @@ RuleStmt: CREATE opt_or_replace RULE name AS
|
||||||
|
|
||||||
RuleActionList:
|
RuleActionList:
|
||||||
NOTHING { $$ = NIL; }
|
NOTHING { $$ = NIL; }
|
||||||
| RuleActionStmt { $$ = makeList1($1); }
|
| RuleActionStmt { $$ = list_make1($1); }
|
||||||
| '(' RuleActionMulti ')' { $$ = $2; }
|
| '(' RuleActionMulti ')' { $$ = $2; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -3639,7 +3639,7 @@ RuleActionMulti:
|
||||||
}
|
}
|
||||||
| RuleActionStmtOrEmpty
|
| RuleActionStmtOrEmpty
|
||||||
{ if ($1 != NULL)
|
{ if ($1 != NULL)
|
||||||
$$ = makeList1($1);
|
$$ = list_make1($1);
|
||||||
else
|
else
|
||||||
$$ = NIL;
|
$$ = NIL;
|
||||||
}
|
}
|
||||||
|
@ -3788,24 +3788,24 @@ opt_transaction: WORK {}
|
||||||
|
|
||||||
transaction_mode_list:
|
transaction_mode_list:
|
||||||
ISOLATION LEVEL iso_level
|
ISOLATION LEVEL iso_level
|
||||||
{ $$ = makeList1(makeDefElem("transaction_isolation",
|
{ $$ = list_make1(makeDefElem("transaction_isolation",
|
||||||
makeStringConst($3, NULL))); }
|
makeStringConst($3, NULL))); }
|
||||||
| transaction_access_mode
|
| transaction_access_mode
|
||||||
{ $$ = makeList1(makeDefElem("transaction_read_only",
|
{ $$ = list_make1(makeDefElem("transaction_read_only",
|
||||||
makeIntConst($1))); }
|
makeIntConst($1))); }
|
||||||
| ISOLATION LEVEL iso_level transaction_access_mode
|
| ISOLATION LEVEL iso_level transaction_access_mode
|
||||||
{
|
{
|
||||||
$$ = makeList2(makeDefElem("transaction_isolation",
|
$$ = list_make2(makeDefElem("transaction_isolation",
|
||||||
makeStringConst($3, NULL)),
|
makeStringConst($3, NULL)),
|
||||||
makeDefElem("transaction_read_only",
|
makeDefElem("transaction_read_only",
|
||||||
makeIntConst($4)));
|
makeIntConst($4)));
|
||||||
}
|
}
|
||||||
| transaction_access_mode ISOLATION LEVEL iso_level
|
| transaction_access_mode ISOLATION LEVEL iso_level
|
||||||
{
|
{
|
||||||
$$ = makeList2(makeDefElem("transaction_read_only",
|
$$ = list_make2(makeDefElem("transaction_read_only",
|
||||||
makeIntConst($1)),
|
makeIntConst($1)),
|
||||||
makeDefElem("transaction_isolation",
|
makeDefElem("transaction_isolation",
|
||||||
makeStringConst($4, NULL)));
|
makeStringConst($4, NULL)));
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -4258,7 +4258,7 @@ prep_type_clause: '(' prep_type_list ')' { $$ = $2; }
|
||||||
| /* EMPTY */ { $$ = NIL; }
|
| /* EMPTY */ { $$ = NIL; }
|
||||||
;
|
;
|
||||||
|
|
||||||
prep_type_list: Typename { $$ = makeList1($1); }
|
prep_type_list: Typename { $$ = list_make1($1); }
|
||||||
| prep_type_list ',' Typename
|
| prep_type_list ',' Typename
|
||||||
{ $$ = lappend($1, $3); }
|
{ $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
@ -4380,7 +4380,7 @@ insert_rest:
|
||||||
;
|
;
|
||||||
|
|
||||||
insert_column_list:
|
insert_column_list:
|
||||||
insert_column_item { $$ = makeList1($1); }
|
insert_column_item { $$ = list_make1($1); }
|
||||||
| insert_column_list ',' insert_column_item
|
| insert_column_list ',' insert_column_item
|
||||||
{ $$ = lappend($1, $3); }
|
{ $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
@ -4566,13 +4566,13 @@ select_no_parens:
|
||||||
| select_clause opt_sort_clause for_update_clause opt_select_limit
|
| select_clause opt_sort_clause for_update_clause opt_select_limit
|
||||||
{
|
{
|
||||||
insertSelectOptions((SelectStmt *) $1, $2, $3,
|
insertSelectOptions((SelectStmt *) $1, $2, $3,
|
||||||
nth(0, $4), nth(1, $4));
|
list_nth($4, 0), list_nth($4, 1));
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
}
|
}
|
||||||
| select_clause opt_sort_clause select_limit opt_for_update_clause
|
| select_clause opt_sort_clause select_limit opt_for_update_clause
|
||||||
{
|
{
|
||||||
insertSelectOptions((SelectStmt *) $1, $2, $4,
|
insertSelectOptions((SelectStmt *) $1, $2, $4,
|
||||||
nth(0, $3), nth(1, $3));
|
list_nth($3, 0), list_nth($3, 1));
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
@ -4701,7 +4701,7 @@ opt_all: ALL { $$ = TRUE; }
|
||||||
* should be placed in the DISTINCT list during parsetree analysis.
|
* should be placed in the DISTINCT list during parsetree analysis.
|
||||||
*/
|
*/
|
||||||
opt_distinct:
|
opt_distinct:
|
||||||
DISTINCT { $$ = makeList1(NIL); }
|
DISTINCT { $$ = list_make1(NIL); }
|
||||||
| DISTINCT ON '(' expr_list ')' { $$ = $4; }
|
| DISTINCT ON '(' expr_list ')' { $$ = $4; }
|
||||||
| ALL { $$ = NIL; }
|
| ALL { $$ = NIL; }
|
||||||
| /*EMPTY*/ { $$ = NIL; }
|
| /*EMPTY*/ { $$ = NIL; }
|
||||||
|
@ -4717,7 +4717,7 @@ sort_clause:
|
||||||
;
|
;
|
||||||
|
|
||||||
sortby_list:
|
sortby_list:
|
||||||
sortby { $$ = makeList1($1); }
|
sortby { $$ = list_make1($1); }
|
||||||
| sortby_list ',' sortby { $$ = lappend($1, $3); }
|
| sortby_list ',' sortby { $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -4754,13 +4754,13 @@ sortby: a_expr USING qual_all_Op
|
||||||
|
|
||||||
select_limit:
|
select_limit:
|
||||||
LIMIT select_limit_value OFFSET select_offset_value
|
LIMIT select_limit_value OFFSET select_offset_value
|
||||||
{ $$ = makeList2($4, $2); }
|
{ $$ = list_make2($4, $2); }
|
||||||
| OFFSET select_offset_value LIMIT select_limit_value
|
| OFFSET select_offset_value LIMIT select_limit_value
|
||||||
{ $$ = makeList2($2, $4); }
|
{ $$ = list_make2($2, $4); }
|
||||||
| LIMIT select_limit_value
|
| LIMIT select_limit_value
|
||||||
{ $$ = makeList2(NULL, $2); }
|
{ $$ = list_make2(NULL, $2); }
|
||||||
| OFFSET select_offset_value
|
| OFFSET select_offset_value
|
||||||
{ $$ = makeList2($2, NULL); }
|
{ $$ = list_make2($2, NULL); }
|
||||||
| LIMIT select_limit_value ',' select_offset_value
|
| LIMIT select_limit_value ',' select_offset_value
|
||||||
{
|
{
|
||||||
/* Disabled because it was too confusing, bjm 2002-02-18 */
|
/* Disabled because it was too confusing, bjm 2002-02-18 */
|
||||||
|
@ -4774,7 +4774,7 @@ select_limit:
|
||||||
opt_select_limit:
|
opt_select_limit:
|
||||||
select_limit { $$ = $1; }
|
select_limit { $$ = $1; }
|
||||||
| /* EMPTY */
|
| /* EMPTY */
|
||||||
{ $$ = makeList2(NULL,NULL); }
|
{ $$ = list_make2(NULL,NULL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
select_limit_value:
|
select_limit_value:
|
||||||
|
@ -4822,7 +4822,7 @@ opt_for_update_clause:
|
||||||
|
|
||||||
update_list:
|
update_list:
|
||||||
OF name_list { $$ = $2; }
|
OF name_list { $$ = $2; }
|
||||||
| /* EMPTY */ { $$ = makeList1(NULL); }
|
| /* EMPTY */ { $$ = list_make1(NULL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
@ -4839,7 +4839,7 @@ from_clause:
|
||||||
;
|
;
|
||||||
|
|
||||||
from_list:
|
from_list:
|
||||||
table_ref { $$ = makeList1($1); }
|
table_ref { $$ = list_make1($1); }
|
||||||
| from_list ',' table_ref { $$ = lappend($1, $3); }
|
| from_list ',' table_ref { $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -5151,7 +5151,7 @@ where_clause:
|
||||||
TableFuncElementList:
|
TableFuncElementList:
|
||||||
TableFuncElement
|
TableFuncElement
|
||||||
{
|
{
|
||||||
$$ = makeList1($1);
|
$$ = list_make1($1);
|
||||||
}
|
}
|
||||||
| TableFuncElementList ',' TableFuncElement
|
| TableFuncElementList ',' TableFuncElement
|
||||||
{
|
{
|
||||||
|
@ -5195,13 +5195,13 @@ Typename: SimpleTypename opt_array_bounds
|
||||||
{
|
{
|
||||||
/* SQL99's redundant syntax */
|
/* SQL99's redundant syntax */
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
$$->arrayBounds = makeList1(makeInteger($4));
|
$$->arrayBounds = list_make1(makeInteger($4));
|
||||||
}
|
}
|
||||||
| SETOF SimpleTypename ARRAY '[' Iconst ']'
|
| SETOF SimpleTypename ARRAY '[' Iconst ']'
|
||||||
{
|
{
|
||||||
/* SQL99's redundant syntax */
|
/* SQL99's redundant syntax */
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
$$->arrayBounds = makeList1(makeInteger($5));
|
$$->arrayBounds = list_make1(makeInteger($5));
|
||||||
$$->setof = TRUE;
|
$$->setof = TRUE;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
@ -5755,7 +5755,7 @@ a_expr: c_expr { $$ = $1; }
|
||||||
{
|
{
|
||||||
FuncCall *n = makeNode(FuncCall);
|
FuncCall *n = makeNode(FuncCall);
|
||||||
n->funcname = SystemFuncName("timezone");
|
n->funcname = SystemFuncName("timezone");
|
||||||
n->args = makeList2($5, $1);
|
n->args = list_make2($5, $1);
|
||||||
n->agg_star = FALSE;
|
n->agg_star = FALSE;
|
||||||
n->agg_distinct = FALSE;
|
n->agg_distinct = FALSE;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
|
@ -5820,7 +5820,7 @@ a_expr: c_expr { $$ = $1; }
|
||||||
{
|
{
|
||||||
FuncCall *n = makeNode(FuncCall);
|
FuncCall *n = makeNode(FuncCall);
|
||||||
n->funcname = SystemFuncName("like_escape");
|
n->funcname = SystemFuncName("like_escape");
|
||||||
n->args = makeList2($3, $5);
|
n->args = list_make2($3, $5);
|
||||||
n->agg_star = FALSE;
|
n->agg_star = FALSE;
|
||||||
n->agg_distinct = FALSE;
|
n->agg_distinct = FALSE;
|
||||||
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~~", $1, (Node *) n);
|
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~~", $1, (Node *) n);
|
||||||
|
@ -5831,7 +5831,7 @@ a_expr: c_expr { $$ = $1; }
|
||||||
{
|
{
|
||||||
FuncCall *n = makeNode(FuncCall);
|
FuncCall *n = makeNode(FuncCall);
|
||||||
n->funcname = SystemFuncName("like_escape");
|
n->funcname = SystemFuncName("like_escape");
|
||||||
n->args = makeList2($4, $6);
|
n->args = list_make2($4, $6);
|
||||||
n->agg_star = FALSE;
|
n->agg_star = FALSE;
|
||||||
n->agg_distinct = FALSE;
|
n->agg_distinct = FALSE;
|
||||||
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~~", $1, (Node *) n);
|
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~~", $1, (Node *) n);
|
||||||
|
@ -5842,7 +5842,7 @@ a_expr: c_expr { $$ = $1; }
|
||||||
{
|
{
|
||||||
FuncCall *n = makeNode(FuncCall);
|
FuncCall *n = makeNode(FuncCall);
|
||||||
n->funcname = SystemFuncName("like_escape");
|
n->funcname = SystemFuncName("like_escape");
|
||||||
n->args = makeList2($3, $5);
|
n->args = list_make2($3, $5);
|
||||||
n->agg_star = FALSE;
|
n->agg_star = FALSE;
|
||||||
n->agg_distinct = FALSE;
|
n->agg_distinct = FALSE;
|
||||||
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~~*", $1, (Node *) n);
|
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~~*", $1, (Node *) n);
|
||||||
|
@ -5853,7 +5853,7 @@ a_expr: c_expr { $$ = $1; }
|
||||||
{
|
{
|
||||||
FuncCall *n = makeNode(FuncCall);
|
FuncCall *n = makeNode(FuncCall);
|
||||||
n->funcname = SystemFuncName("like_escape");
|
n->funcname = SystemFuncName("like_escape");
|
||||||
n->args = makeList2($4, $6);
|
n->args = list_make2($4, $6);
|
||||||
n->agg_star = FALSE;
|
n->agg_star = FALSE;
|
||||||
n->agg_distinct = FALSE;
|
n->agg_distinct = FALSE;
|
||||||
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~~*", $1, (Node *) n);
|
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~~*", $1, (Node *) n);
|
||||||
|
@ -5865,7 +5865,7 @@ a_expr: c_expr { $$ = $1; }
|
||||||
FuncCall *n = makeNode(FuncCall);
|
FuncCall *n = makeNode(FuncCall);
|
||||||
c->val.type = T_Null;
|
c->val.type = T_Null;
|
||||||
n->funcname = SystemFuncName("similar_escape");
|
n->funcname = SystemFuncName("similar_escape");
|
||||||
n->args = makeList2($4, (Node *) c);
|
n->args = list_make2($4, (Node *) c);
|
||||||
n->agg_star = FALSE;
|
n->agg_star = FALSE;
|
||||||
n->agg_distinct = FALSE;
|
n->agg_distinct = FALSE;
|
||||||
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~", $1, (Node *) n);
|
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~", $1, (Node *) n);
|
||||||
|
@ -5874,7 +5874,7 @@ a_expr: c_expr { $$ = $1; }
|
||||||
{
|
{
|
||||||
FuncCall *n = makeNode(FuncCall);
|
FuncCall *n = makeNode(FuncCall);
|
||||||
n->funcname = SystemFuncName("similar_escape");
|
n->funcname = SystemFuncName("similar_escape");
|
||||||
n->args = makeList2($4, $6);
|
n->args = list_make2($4, $6);
|
||||||
n->agg_star = FALSE;
|
n->agg_star = FALSE;
|
||||||
n->agg_distinct = FALSE;
|
n->agg_distinct = FALSE;
|
||||||
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~", $1, (Node *) n);
|
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~", $1, (Node *) n);
|
||||||
|
@ -5885,7 +5885,7 @@ a_expr: c_expr { $$ = $1; }
|
||||||
FuncCall *n = makeNode(FuncCall);
|
FuncCall *n = makeNode(FuncCall);
|
||||||
c->val.type = T_Null;
|
c->val.type = T_Null;
|
||||||
n->funcname = SystemFuncName("similar_escape");
|
n->funcname = SystemFuncName("similar_escape");
|
||||||
n->args = makeList2($5, (Node *) c);
|
n->args = list_make2($5, (Node *) c);
|
||||||
n->agg_star = FALSE;
|
n->agg_star = FALSE;
|
||||||
n->agg_distinct = FALSE;
|
n->agg_distinct = FALSE;
|
||||||
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~", $1, (Node *) n);
|
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~", $1, (Node *) n);
|
||||||
|
@ -5894,7 +5894,7 @@ a_expr: c_expr { $$ = $1; }
|
||||||
{
|
{
|
||||||
FuncCall *n = makeNode(FuncCall);
|
FuncCall *n = makeNode(FuncCall);
|
||||||
n->funcname = SystemFuncName("similar_escape");
|
n->funcname = SystemFuncName("similar_escape");
|
||||||
n->args = makeList2($5, $7);
|
n->args = list_make2($5, $7);
|
||||||
n->agg_star = FALSE;
|
n->agg_star = FALSE;
|
||||||
n->agg_distinct = FALSE;
|
n->agg_distinct = FALSE;
|
||||||
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~", $1, (Node *) n);
|
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~", $1, (Node *) n);
|
||||||
|
@ -6037,8 +6037,8 @@ a_expr: c_expr { $$ = $1; }
|
||||||
if (IsA($1, RowExpr))
|
if (IsA($1, RowExpr))
|
||||||
n->lefthand = ((RowExpr *) $1)->args;
|
n->lefthand = ((RowExpr *) $1)->args;
|
||||||
else
|
else
|
||||||
n->lefthand = makeList1($1);
|
n->lefthand = list_make1($1);
|
||||||
n->operName = makeList1(makeString("="));
|
n->operName = list_make1(makeString("="));
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -6068,8 +6068,8 @@ a_expr: c_expr { $$ = $1; }
|
||||||
if (IsA($1, RowExpr))
|
if (IsA($1, RowExpr))
|
||||||
n->lefthand = ((RowExpr *) $1)->args;
|
n->lefthand = ((RowExpr *) $1)->args;
|
||||||
else
|
else
|
||||||
n->lefthand = makeList1($1);
|
n->lefthand = list_make1($1);
|
||||||
n->operName = makeList1(makeString("="));
|
n->operName = list_make1(makeString("="));
|
||||||
/* Stick a NOT on top */
|
/* Stick a NOT on top */
|
||||||
$$ = (Node *) makeA_Expr(AEXPR_NOT, NIL, NULL, (Node *) n);
|
$$ = (Node *) makeA_Expr(AEXPR_NOT, NIL, NULL, (Node *) n);
|
||||||
}
|
}
|
||||||
|
@ -6096,7 +6096,7 @@ a_expr: c_expr { $$ = $1; }
|
||||||
if (IsA($1, RowExpr))
|
if (IsA($1, RowExpr))
|
||||||
n->lefthand = ((RowExpr *) $1)->args;
|
n->lefthand = ((RowExpr *) $1)->args;
|
||||||
else
|
else
|
||||||
n->lefthand = makeList1($1);
|
n->lefthand = list_make1($1);
|
||||||
n->operName = $2;
|
n->operName = $2;
|
||||||
n->subselect = $4;
|
n->subselect = $4;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
|
@ -6293,7 +6293,7 @@ c_expr: columnref { $$ = (Node *) $1; }
|
||||||
star->val.type = T_Integer;
|
star->val.type = T_Integer;
|
||||||
star->val.val.ival = 1;
|
star->val.val.ival = 1;
|
||||||
n->funcname = $1;
|
n->funcname = $1;
|
||||||
n->args = makeList1(star);
|
n->args = list_make1(star);
|
||||||
n->agg_star = TRUE;
|
n->agg_star = TRUE;
|
||||||
n->agg_distinct = FALSE;
|
n->agg_distinct = FALSE;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
|
@ -6625,7 +6625,7 @@ c_expr: columnref { $$ = (Node *) $1; }
|
||||||
* at the moment they result in the same thing.
|
* at the moment they result in the same thing.
|
||||||
*/
|
*/
|
||||||
n->funcname = SystemFuncName(((Value *)llast($5->names))->val.str);
|
n->funcname = SystemFuncName(((Value *)llast($5->names))->val.str);
|
||||||
n->args = makeList1($3);
|
n->args = list_make1($3);
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| TRIM '(' BOTH trim_list ')'
|
| TRIM '(' BOTH trim_list ')'
|
||||||
|
@ -6676,7 +6676,7 @@ c_expr: columnref { $$ = (Node *) $1; }
|
||||||
c->val.val.str = NameListToQuotedString($5);
|
c->val.val.str = NameListToQuotedString($5);
|
||||||
|
|
||||||
n->funcname = SystemFuncName("convert_using");
|
n->funcname = SystemFuncName("convert_using");
|
||||||
n->args = makeList2($3, c);
|
n->args = list_make2($3, c);
|
||||||
n->agg_star = FALSE;
|
n->agg_star = FALSE;
|
||||||
n->agg_distinct = FALSE;
|
n->agg_distinct = FALSE;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
|
@ -6764,31 +6764,31 @@ MathOp: '+' { $$ = "+"; }
|
||||||
;
|
;
|
||||||
|
|
||||||
qual_Op: Op
|
qual_Op: Op
|
||||||
{ $$ = makeList1(makeString($1)); }
|
{ $$ = list_make1(makeString($1)); }
|
||||||
| OPERATOR '(' any_operator ')'
|
| OPERATOR '(' any_operator ')'
|
||||||
{ $$ = $3; }
|
{ $$ = $3; }
|
||||||
;
|
;
|
||||||
|
|
||||||
qual_all_Op:
|
qual_all_Op:
|
||||||
all_Op
|
all_Op
|
||||||
{ $$ = makeList1(makeString($1)); }
|
{ $$ = list_make1(makeString($1)); }
|
||||||
| OPERATOR '(' any_operator ')'
|
| OPERATOR '(' any_operator ')'
|
||||||
{ $$ = $3; }
|
{ $$ = $3; }
|
||||||
;
|
;
|
||||||
|
|
||||||
subquery_Op:
|
subquery_Op:
|
||||||
all_Op
|
all_Op
|
||||||
{ $$ = makeList1(makeString($1)); }
|
{ $$ = list_make1(makeString($1)); }
|
||||||
| OPERATOR '(' any_operator ')'
|
| OPERATOR '(' any_operator ')'
|
||||||
{ $$ = $3; }
|
{ $$ = $3; }
|
||||||
| LIKE
|
| LIKE
|
||||||
{ $$ = makeList1(makeString("~~")); }
|
{ $$ = list_make1(makeString("~~")); }
|
||||||
| NOT LIKE
|
| NOT LIKE
|
||||||
{ $$ = makeList1(makeString("!~~")); }
|
{ $$ = list_make1(makeString("!~~")); }
|
||||||
| ILIKE
|
| ILIKE
|
||||||
{ $$ = makeList1(makeString("~~*")); }
|
{ $$ = list_make1(makeString("~~*")); }
|
||||||
| NOT ILIKE
|
| NOT ILIKE
|
||||||
{ $$ = makeList1(makeString("!~~*")); }
|
{ $$ = list_make1(makeString("!~~*")); }
|
||||||
/* cannot put SIMILAR TO here, because SIMILAR TO is a hack.
|
/* cannot put SIMILAR TO here, because SIMILAR TO is a hack.
|
||||||
* the regular expression is preprocessed by a function (similar_escape),
|
* the regular expression is preprocessed by a function (similar_escape),
|
||||||
* and the ~ operator for posix regular expressions is used.
|
* and the ~ operator for posix regular expressions is used.
|
||||||
|
@ -6838,7 +6838,7 @@ extract_list:
|
||||||
A_Const *n = makeNode(A_Const);
|
A_Const *n = makeNode(A_Const);
|
||||||
n->val.type = T_String;
|
n->val.type = T_String;
|
||||||
n->val.val.str = $1;
|
n->val.val.str = $1;
|
||||||
$$ = makeList2((Node *) n, $3);
|
$$ = list_make2((Node *) n, $3);
|
||||||
}
|
}
|
||||||
| /*EMPTY*/ { $$ = NIL; }
|
| /*EMPTY*/ { $$ = NIL; }
|
||||||
;
|
;
|
||||||
|
@ -6849,12 +6849,12 @@ type_list: type_list ',' Typename
|
||||||
}
|
}
|
||||||
| Typename
|
| Typename
|
||||||
{
|
{
|
||||||
$$ = makeList1($1);
|
$$ = list_make1($1);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
array_expr_list: array_expr
|
array_expr_list: array_expr
|
||||||
{ $$ = makeList1($1); }
|
{ $$ = list_make1($1); }
|
||||||
| array_expr_list ',' array_expr
|
| array_expr_list ',' array_expr
|
||||||
{ $$ = lappend($1, $3); }
|
{ $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
@ -6896,11 +6896,11 @@ extract_arg:
|
||||||
overlay_list:
|
overlay_list:
|
||||||
a_expr overlay_placing substr_from substr_for
|
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
|
| 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 uses b_expr not a_expr to avoid conflict with general IN */
|
||||||
|
|
||||||
position_list:
|
position_list:
|
||||||
b_expr IN_P b_expr { $$ = makeList2($3, $1); }
|
b_expr IN_P b_expr { $$ = list_make2($3, $1); }
|
||||||
| /*EMPTY*/ { $$ = NIL; }
|
| /*EMPTY*/ { $$ = NIL; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -6930,22 +6930,22 @@ position_list:
|
||||||
substr_list:
|
substr_list:
|
||||||
a_expr substr_from substr_for
|
a_expr substr_from substr_for
|
||||||
{
|
{
|
||||||
$$ = makeList3($1, $2, $3);
|
$$ = list_make3($1, $2, $3);
|
||||||
}
|
}
|
||||||
| a_expr substr_for substr_from
|
| a_expr substr_for substr_from
|
||||||
{
|
{
|
||||||
$$ = makeList3($1, $3, $2);
|
$$ = list_make3($1, $3, $2);
|
||||||
}
|
}
|
||||||
| a_expr substr_from
|
| a_expr substr_from
|
||||||
{
|
{
|
||||||
$$ = makeList2($1, $2);
|
$$ = list_make2($1, $2);
|
||||||
}
|
}
|
||||||
| a_expr substr_for
|
| a_expr substr_for
|
||||||
{
|
{
|
||||||
A_Const *n = makeNode(A_Const);
|
A_Const *n = makeNode(A_Const);
|
||||||
n->val.type = T_Integer;
|
n->val.type = T_Integer;
|
||||||
n->val.val.ival = 1;
|
n->val.val.ival = 1;
|
||||||
$$ = makeList3($1, (Node *)n, $2);
|
$$ = list_make3($1, (Node *)n, $2);
|
||||||
}
|
}
|
||||||
| expr_list
|
| expr_list
|
||||||
{
|
{
|
||||||
|
@ -7019,7 +7019,7 @@ case_expr: CASE case_arg when_clause_list case_default END_P
|
||||||
|
|
||||||
when_clause_list:
|
when_clause_list:
|
||||||
/* There must be at least one */
|
/* There must be at least one */
|
||||||
when_clause { $$ = makeList1($1); }
|
when_clause { $$ = list_make1($1); }
|
||||||
| when_clause_list when_clause { $$ = lappend($1, $2); }
|
| when_clause_list when_clause { $$ = lappend($1, $2); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -7050,7 +7050,7 @@ case_arg: a_expr { $$ = $1; }
|
||||||
columnref: relation_name opt_indirection
|
columnref: relation_name opt_indirection
|
||||||
{
|
{
|
||||||
$$ = makeNode(ColumnRef);
|
$$ = makeNode(ColumnRef);
|
||||||
$$->fields = makeList1(makeString($1));
|
$$->fields = list_make1(makeString($1));
|
||||||
$$->indirection = $2;
|
$$->indirection = $2;
|
||||||
}
|
}
|
||||||
| dotted_name opt_indirection
|
| dotted_name opt_indirection
|
||||||
|
@ -7067,9 +7067,9 @@ dotted_name:
|
||||||
;
|
;
|
||||||
|
|
||||||
attrs: '.' attr_name
|
attrs: '.' attr_name
|
||||||
{ $$ = makeList1(makeString($2)); }
|
{ $$ = list_make1(makeString($2)); }
|
||||||
| '.' '*'
|
| '.' '*'
|
||||||
{ $$ = makeList1(makeString("*")); }
|
{ $$ = list_make1(makeString("*")); }
|
||||||
| '.' attr_name attrs
|
| '.' attr_name attrs
|
||||||
{ $$ = lcons(makeString($2), $3); }
|
{ $$ = lcons(makeString($2), $3); }
|
||||||
;
|
;
|
||||||
|
@ -7084,7 +7084,7 @@ attrs: '.' attr_name
|
||||||
/* Target lists as found in SELECT ... and INSERT VALUES ( ... ) */
|
/* Target lists as found in SELECT ... and INSERT VALUES ( ... ) */
|
||||||
|
|
||||||
target_list:
|
target_list:
|
||||||
target_el { $$ = makeList1($1); }
|
target_el { $$ = list_make1($1); }
|
||||||
| target_list ',' target_el { $$ = lappend($1, $3); }
|
| target_list ',' target_el { $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -7106,7 +7106,7 @@ target_el: a_expr AS ColLabel
|
||||||
| '*'
|
| '*'
|
||||||
{
|
{
|
||||||
ColumnRef *n = makeNode(ColumnRef);
|
ColumnRef *n = makeNode(ColumnRef);
|
||||||
n->fields = makeList1(makeString("*"));
|
n->fields = list_make1(makeString("*"));
|
||||||
n->indirection = NIL;
|
n->indirection = NIL;
|
||||||
$$ = makeNode(ResTarget);
|
$$ = makeNode(ResTarget);
|
||||||
$$->name = NULL;
|
$$->name = NULL;
|
||||||
|
@ -7122,7 +7122,7 @@ target_el: a_expr AS ColLabel
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
update_target_list:
|
update_target_list:
|
||||||
update_target_el { $$ = makeList1($1); }
|
update_target_el { $$ = list_make1($1); }
|
||||||
| update_target_list ',' update_target_el { $$ = lappend($1,$3); }
|
| update_target_list ',' update_target_el { $$ = lappend($1,$3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -7145,7 +7145,7 @@ update_target_el:
|
||||||
;
|
;
|
||||||
|
|
||||||
insert_target_list:
|
insert_target_list:
|
||||||
insert_target_el { $$ = makeList1($1); }
|
insert_target_el { $$ = list_make1($1); }
|
||||||
| insert_target_list ',' insert_target_el { $$ = lappend($1, $3); }
|
| insert_target_list ',' insert_target_el { $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -7173,7 +7173,7 @@ relation_name:
|
||||||
;
|
;
|
||||||
|
|
||||||
qualified_name_list:
|
qualified_name_list:
|
||||||
qualified_name { $$ = makeList1($1); }
|
qualified_name { $$ = list_make1($1); }
|
||||||
| qualified_name_list ',' qualified_name { $$ = lappend($1, $3); }
|
| qualified_name_list ',' qualified_name { $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -7188,7 +7188,7 @@ qualified_name:
|
||||||
| dotted_name
|
| dotted_name
|
||||||
{
|
{
|
||||||
$$ = makeNode(RangeVar);
|
$$ = makeNode(RangeVar);
|
||||||
switch (length($1))
|
switch (list_length($1))
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
$$->catalogname = NULL;
|
$$->catalogname = NULL;
|
||||||
|
@ -7211,7 +7211,7 @@ qualified_name:
|
||||||
;
|
;
|
||||||
|
|
||||||
name_list: name
|
name_list: name
|
||||||
{ $$ = makeList1(makeString($1)); }
|
{ $$ = list_make1(makeString($1)); }
|
||||||
| name_list ',' name
|
| name_list ',' name
|
||||||
{ $$ = lappend($1, makeString($3)); }
|
{ $$ = lappend($1, makeString($3)); }
|
||||||
;
|
;
|
||||||
|
@ -7232,7 +7232,7 @@ index_name: ColId { $$ = $1; };
|
||||||
file_name: Sconst { $$ = $1; };
|
file_name: Sconst { $$ = $1; };
|
||||||
|
|
||||||
func_name: function_name
|
func_name: function_name
|
||||||
{ $$ = makeList1(makeString($1)); }
|
{ $$ = list_make1(makeString($1)); }
|
||||||
| dotted_name { $$ = $1; }
|
| dotted_name { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -7924,19 +7924,19 @@ makeOverlaps(List *largs, List *rargs)
|
||||||
{
|
{
|
||||||
FuncCall *n = makeNode(FuncCall);
|
FuncCall *n = makeNode(FuncCall);
|
||||||
n->funcname = SystemFuncName("overlaps");
|
n->funcname = SystemFuncName("overlaps");
|
||||||
if (length(largs) == 1)
|
if (list_length(largs) == 1)
|
||||||
largs = lappend(largs, largs);
|
largs = lappend(largs, largs);
|
||||||
else if (length(largs) != 2)
|
else if (list_length(largs) != 2)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
errmsg("wrong number of parameters on left side of OVERLAPS expression")));
|
errmsg("wrong number of parameters on left side of OVERLAPS expression")));
|
||||||
if (length(rargs) == 1)
|
if (list_length(rargs) == 1)
|
||||||
rargs = lappend(rargs, rargs);
|
rargs = lappend(rargs, rargs);
|
||||||
else if (length(rargs) != 2)
|
else if (list_length(rargs) != 2)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
errmsg("wrong number of parameters on right side of OVERLAPS expression")));
|
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_star = FALSE;
|
||||||
n->agg_distinct = FALSE;
|
n->agg_distinct = FALSE;
|
||||||
return n;
|
return n;
|
||||||
|
@ -8041,7 +8041,7 @@ makeSetOp(SetOperation op, bool all, Node *larg, Node *rarg)
|
||||||
List *
|
List *
|
||||||
SystemFuncName(char *name)
|
SystemFuncName(char *name)
|
||||||
{
|
{
|
||||||
return makeList2(makeString("pg_catalog"), makeString(name));
|
return list_make2(makeString("pg_catalog"), makeString(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SystemTypeName()
|
/* SystemTypeName()
|
||||||
|
@ -8054,7 +8054,7 @@ SystemTypeName(char *name)
|
||||||
{
|
{
|
||||||
TypeName *n = makeNode(TypeName);
|
TypeName *n = makeNode(TypeName);
|
||||||
|
|
||||||
n->names = makeList2(makeString("pg_catalog"), makeString(name));
|
n->names = list_make2(makeString("pg_catalog"), makeString(name));
|
||||||
n->typmod = -1;
|
n->typmod = -1;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 */
|
/* Found an ungrouped local variable; generate error message */
|
||||||
Assert(var->varno > 0 &&
|
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);
|
rte = rt_fetch(var->varno, context->pstate->p_rtable);
|
||||||
attname = get_rte_attribute_name(rte, var->varattno);
|
attname = get_rte_attribute_name(rte, var->varattno);
|
||||||
if (context->sublevels_up == 0)
|
if (context->sublevels_up == 0)
|
||||||
|
@ -394,10 +394,10 @@ build_aggregate_fnexprs(Oid agg_input_type,
|
||||||
arg1->paramid = -1;
|
arg1->paramid = -1;
|
||||||
arg1->paramtype = agg_input_type;
|
arg1->paramtype = agg_input_type;
|
||||||
|
|
||||||
args = makeList2(arg0, arg1);
|
args = list_make2(arg0, arg1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
args = makeList1(arg0);
|
args = list_make1(arg0);
|
||||||
|
|
||||||
*transfnexpr = (Expr *) makeFuncExpr(transfn_oid,
|
*transfnexpr = (Expr *) makeFuncExpr(transfn_oid,
|
||||||
agg_state_type,
|
agg_state_type,
|
||||||
|
@ -418,7 +418,7 @@ build_aggregate_fnexprs(Oid agg_input_type,
|
||||||
arg0->paramkind = PARAM_EXEC;
|
arg0->paramkind = PARAM_EXEC;
|
||||||
arg0->paramid = -1;
|
arg0->paramid = -1;
|
||||||
arg0->paramtype = agg_state_type;
|
arg0->paramtype = agg_state_type;
|
||||||
args = makeList1(arg0);
|
args = list_make1(arg0);
|
||||||
|
|
||||||
*finalfnexpr = (Expr *) makeFuncExpr(finalfn_oid,
|
*finalfnexpr = (Expr *) makeFuncExpr(finalfn_oid,
|
||||||
agg_result_type,
|
agg_result_type,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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;
|
pstate->p_target_rangetblentry = rte;
|
||||||
|
|
||||||
/* assume new rte is at end */
|
/* 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));
|
Assert(rte == rt_fetch(rtindex, pstate->p_rtable));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -233,7 +233,7 @@ extractRemainingColumns(List *common_colnames,
|
||||||
List *new_colvars = NIL;
|
List *new_colvars = NIL;
|
||||||
ListCell *lnames, *lvars;
|
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)
|
forboth(lnames, src_colnames, lvars, src_colvars)
|
||||||
{
|
{
|
||||||
|
@ -336,7 +336,7 @@ transformJoinOnClause(ParseState *pstate, JoinExpr *j,
|
||||||
* to be added.
|
* to be added.
|
||||||
*/
|
*/
|
||||||
save_namespace = pstate->p_namespace;
|
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");
|
result = transformWhereClause(pstate, j->quals, "JOIN/ON");
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ transformJoinOnClause(ParseState *pstate, JoinExpr *j,
|
||||||
clause_varnos = pull_varnos(result);
|
clause_varnos = pull_varnos(result);
|
||||||
while ((varno = bms_first_member(clause_varnos)) >= 0)
|
while ((varno = bms_first_member(clause_varnos)) >= 0)
|
||||||
{
|
{
|
||||||
if (!intMember(varno, containedRels))
|
if (!list_member_int(containedRels, varno))
|
||||||
{
|
{
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
|
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
|
||||||
|
@ -391,7 +391,7 @@ transformTableEntry(ParseState *pstate, RangeVar *r)
|
||||||
*/
|
*/
|
||||||
rtr = makeNode(RangeTblRef);
|
rtr = makeNode(RangeTblRef);
|
||||||
/* assume new rte is at end */
|
/* 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));
|
Assert(rte == rt_fetch(rtr->rtindex, pstate->p_rtable));
|
||||||
|
|
||||||
return rtr;
|
return rtr;
|
||||||
|
@ -429,7 +429,7 @@ transformRangeSubselect(ParseState *pstate, RangeSubselect *r)
|
||||||
* are probably impossible given restrictions of the grammar, but
|
* are probably impossible given restrictions of the grammar, but
|
||||||
* check 'em anyway.
|
* check 'em anyway.
|
||||||
*/
|
*/
|
||||||
if (length(parsetrees) != 1)
|
if (list_length(parsetrees) != 1)
|
||||||
elog(ERROR, "unexpected parse analysis result for subquery in FROM");
|
elog(ERROR, "unexpected parse analysis result for subquery in FROM");
|
||||||
query = (Query *) linitial(parsetrees);
|
query = (Query *) linitial(parsetrees);
|
||||||
if (query == NULL || !IsA(query, Query))
|
if (query == NULL || !IsA(query, Query))
|
||||||
|
@ -476,7 +476,7 @@ transformRangeSubselect(ParseState *pstate, RangeSubselect *r)
|
||||||
*/
|
*/
|
||||||
rtr = makeNode(RangeTblRef);
|
rtr = makeNode(RangeTblRef);
|
||||||
/* assume new rte is at end */
|
/* 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));
|
Assert(rte == rt_fetch(rtr->rtindex, pstate->p_rtable));
|
||||||
|
|
||||||
return rtr;
|
return rtr;
|
||||||
|
@ -556,7 +556,7 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r)
|
||||||
*/
|
*/
|
||||||
rtr = makeNode(RangeTblRef);
|
rtr = makeNode(RangeTblRef);
|
||||||
/* assume new rte is at end */
|
/* 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));
|
Assert(rte == rt_fetch(rtr->rtindex, pstate->p_rtable));
|
||||||
|
|
||||||
return rtr;
|
return rtr;
|
||||||
|
@ -584,7 +584,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
|
||||||
RangeTblRef *rtr;
|
RangeTblRef *rtr;
|
||||||
|
|
||||||
rtr = transformTableEntry(pstate, (RangeVar *) n);
|
rtr = transformTableEntry(pstate, (RangeVar *) n);
|
||||||
*containedRels = makeListi1(rtr->rtindex);
|
*containedRels = list_make1_int(rtr->rtindex);
|
||||||
return (Node *) rtr;
|
return (Node *) rtr;
|
||||||
}
|
}
|
||||||
else if (IsA(n, RangeSubselect))
|
else if (IsA(n, RangeSubselect))
|
||||||
|
@ -593,7 +593,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
|
||||||
RangeTblRef *rtr;
|
RangeTblRef *rtr;
|
||||||
|
|
||||||
rtr = transformRangeSubselect(pstate, (RangeSubselect *) n);
|
rtr = transformRangeSubselect(pstate, (RangeSubselect *) n);
|
||||||
*containedRels = makeListi1(rtr->rtindex);
|
*containedRels = list_make1_int(rtr->rtindex);
|
||||||
return (Node *) rtr;
|
return (Node *) rtr;
|
||||||
}
|
}
|
||||||
else if (IsA(n, RangeFunction))
|
else if (IsA(n, RangeFunction))
|
||||||
|
@ -602,7 +602,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
|
||||||
RangeTblRef *rtr;
|
RangeTblRef *rtr;
|
||||||
|
|
||||||
rtr = transformRangeFunction(pstate, (RangeFunction *) n);
|
rtr = transformRangeFunction(pstate, (RangeFunction *) n);
|
||||||
*containedRels = makeListi1(rtr->rtindex);
|
*containedRels = list_make1_int(rtr->rtindex);
|
||||||
return (Node *) rtr;
|
return (Node *) rtr;
|
||||||
}
|
}
|
||||||
else if (IsA(n, JoinExpr))
|
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
|
* Generate combined list of relation indexes for possible use by
|
||||||
* transformJoinOnClause below.
|
* 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
|
* 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",
|
errmsg("column \"%s\" specified in USING clause does not exist in right table",
|
||||||
u_colname)));
|
u_colname)));
|
||||||
|
|
||||||
l_colvar = nth(l_index, l_colvars);
|
l_colvar = list_nth(l_colvars, l_index);
|
||||||
l_usingvars = lappend(l_usingvars, l_colvar);
|
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);
|
r_usingvars = lappend(r_usingvars, r_colvar);
|
||||||
|
|
||||||
res_colnames = lappend(res_colnames, lfirst(ucol));
|
res_colnames = lappend(res_colnames, lfirst(ucol));
|
||||||
|
@ -833,10 +833,10 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
|
||||||
extractRemainingColumns(res_colnames,
|
extractRemainingColumns(res_colnames,
|
||||||
r_colnames, r_colvars,
|
r_colnames, r_colvars,
|
||||||
&r_colnames, &r_colvars);
|
&r_colnames, &r_colvars);
|
||||||
res_colnames = nconc(res_colnames, l_colnames);
|
res_colnames = list_concat(res_colnames, l_colnames);
|
||||||
res_colvars = nconc(res_colvars, l_colvars);
|
res_colvars = list_concat(res_colvars, l_colvars);
|
||||||
res_colnames = nconc(res_colnames, r_colnames);
|
res_colnames = list_concat(res_colnames, r_colnames);
|
||||||
res_colvars = nconc(res_colvars, r_colvars);
|
res_colvars = list_concat(res_colvars, r_colvars);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check alias (AS clause), if any.
|
* Check alias (AS clause), if any.
|
||||||
|
@ -845,7 +845,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
|
||||||
{
|
{
|
||||||
if (j->alias->colnames != NIL)
|
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,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
errmsg("column alias list for \"%s\" has too many entries",
|
errmsg("column alias list for \"%s\" has too many entries",
|
||||||
|
@ -864,13 +864,13 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
|
||||||
true);
|
true);
|
||||||
|
|
||||||
/* assume new rte is at end */
|
/* 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));
|
Assert(rte == rt_fetch(j->rtindex, pstate->p_rtable));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Include join RTE in returned containedRels list
|
* Include join RTE in returned containedRels list
|
||||||
*/
|
*/
|
||||||
*containedRels = lconsi(j->rtindex, my_containedRels);
|
*containedRels = lcons_int(j->rtindex, my_containedRels);
|
||||||
|
|
||||||
return (Node *) j;
|
return (Node *) j;
|
||||||
}
|
}
|
||||||
|
@ -900,8 +900,8 @@ buildMergedJoinVar(ParseState *pstate, JoinType jointype,
|
||||||
outcoltypmod = l_colvar->vartypmod;
|
outcoltypmod = l_colvar->vartypmod;
|
||||||
if (outcoltype != r_colvar->vartype)
|
if (outcoltype != r_colvar->vartype)
|
||||||
{
|
{
|
||||||
outcoltype = select_common_type(makeListo2(l_colvar->vartype,
|
outcoltype = select_common_type(list_make2_oid(l_colvar->vartype,
|
||||||
r_colvar->vartype),
|
r_colvar->vartype),
|
||||||
"JOIN/USING");
|
"JOIN/USING");
|
||||||
outcoltypmod = -1; /* ie, unknown */
|
outcoltypmod = -1; /* ie, unknown */
|
||||||
}
|
}
|
||||||
|
@ -973,7 +973,7 @@ buildMergedJoinVar(ParseState *pstate, JoinType jointype,
|
||||||
CoalesceExpr *c = makeNode(CoalesceExpr);
|
CoalesceExpr *c = makeNode(CoalesceExpr);
|
||||||
|
|
||||||
c->coalescetype = outcoltype;
|
c->coalescetype = outcoltype;
|
||||||
c->args = makeList2(l_node, r_node);
|
c->args = list_make2(l_node, r_node);
|
||||||
res_node = (Node *) c;
|
res_node = (Node *) c;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1122,7 +1122,7 @@ findTargetlistEntry(ParseState *pstate, Node *node, List **tlist, int clause)
|
||||||
*----------
|
*----------
|
||||||
*/
|
*/
|
||||||
if (IsA(node, ColumnRef) &&
|
if (IsA(node, ColumnRef) &&
|
||||||
length(((ColumnRef *) node)->fields) == 1 &&
|
list_length(((ColumnRef *) node)->fields) == 1 &&
|
||||||
((ColumnRef *) node)->indirection == NIL)
|
((ColumnRef *) node)->indirection == NIL)
|
||||||
{
|
{
|
||||||
char *name = strVal(linitial(((ColumnRef *) node)->fields));
|
char *name = strVal(linitial(((ColumnRef *) node)->fields));
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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);
|
Oid baseTypeId = getBaseType(targetTypeId);
|
||||||
|
|
||||||
result = (Node *) makeFuncExpr(funcId, baseTypeId,
|
result = (Node *) makeFuncExpr(funcId, baseTypeId,
|
||||||
makeList1(node),
|
list_make1(node),
|
||||||
cformat);
|
cformat);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -508,7 +508,7 @@ coerce_type_typmod(Node *node, Oid targetTypeId, int32 targetTypMod,
|
||||||
false,
|
false,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
args = makeList2(node, cons);
|
args = list_make2(node, cons);
|
||||||
|
|
||||||
if (nargs == 3)
|
if (nargs == 3)
|
||||||
{
|
{
|
||||||
|
@ -562,7 +562,7 @@ coerce_record_to_complex(ParseState *pstate, Node *node,
|
||||||
rte = GetRTEByRangeTablePosn(pstate,
|
rte = GetRTEByRangeTablePosn(pstate,
|
||||||
((Var *) node)->varno,
|
((Var *) node)->varno,
|
||||||
((Var *) node)->varlevelsup);
|
((Var *) node)->varlevelsup);
|
||||||
nfields = length(rte->eref->colnames);
|
nfields = list_length(rte->eref->colnames);
|
||||||
for (nf = 1; nf <= nfields; nf++)
|
for (nf = 1; nf <= nfields; nf++)
|
||||||
{
|
{
|
||||||
Oid vartype;
|
Oid vartype;
|
||||||
|
@ -585,7 +585,7 @@ coerce_record_to_complex(ParseState *pstate, Node *node,
|
||||||
format_type_be(targetTypeId))));
|
format_type_be(targetTypeId))));
|
||||||
|
|
||||||
tupdesc = lookup_rowtype_tupdesc(targetTypeId, -1);
|
tupdesc = lookup_rowtype_tupdesc(targetTypeId, -1);
|
||||||
if (length(args) != tupdesc->natts)
|
if (list_length(args) != tupdesc->natts)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_CANNOT_COERCE),
|
(errcode(ERRCODE_CANNOT_COERCE),
|
||||||
errmsg("cannot cast type %s to %s",
|
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)))
|
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... */
|
/* move on to next one if no new information... */
|
||||||
if ((ntype != InvalidOid) && (ntype != UNKNOWNOID) && (ntype != ptype))
|
if ((ntype != InvalidOid) && (ntype != UNKNOWNOID) && (ntype != ptype))
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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)
|
foreach(fields, pref->fields)
|
||||||
{
|
{
|
||||||
result = ParseFuncOrColumn(pstate,
|
result = ParseFuncOrColumn(pstate,
|
||||||
makeList1(lfirst(fields)),
|
list_make1(lfirst(fields)),
|
||||||
makeList1(result),
|
list_make1(result),
|
||||||
false, false, true);
|
false, false, true);
|
||||||
}
|
}
|
||||||
/* handle subscripts, if any */
|
/* handle subscripts, if any */
|
||||||
|
@ -183,8 +183,8 @@ transformExpr(ParseState *pstate, Node *expr)
|
||||||
foreach(fields, efs->fields)
|
foreach(fields, efs->fields)
|
||||||
{
|
{
|
||||||
result = ParseFuncOrColumn(pstate,
|
result = ParseFuncOrColumn(pstate,
|
||||||
makeList1(lfirst(fields)),
|
list_make1(lfirst(fields)),
|
||||||
makeList1(result),
|
list_make1(result),
|
||||||
false, false, true);
|
false, false, true);
|
||||||
}
|
}
|
||||||
/* handle subscripts, if any */
|
/* handle subscripts, if any */
|
||||||
|
@ -218,7 +218,7 @@ transformExpr(ParseState *pstate, Node *expr)
|
||||||
* into IS NULL exprs.
|
* into IS NULL exprs.
|
||||||
*/
|
*/
|
||||||
if (Transform_null_equals &&
|
if (Transform_null_equals &&
|
||||||
length(a->name) == 1 &&
|
list_length(a->name) == 1 &&
|
||||||
strcmp(strVal(linitial(a->name)), "=") == 0 &&
|
strcmp(strVal(linitial(a->name)), "=") == 0 &&
|
||||||
(exprIsNullConstant(lexpr) ||
|
(exprIsNullConstant(lexpr) ||
|
||||||
exprIsNullConstant(rexpr)))
|
exprIsNullConstant(rexpr)))
|
||||||
|
@ -284,8 +284,8 @@ transformExpr(ParseState *pstate, Node *expr)
|
||||||
rexpr = coerce_to_boolean(pstate, rexpr, "AND");
|
rexpr = coerce_to_boolean(pstate, rexpr, "AND");
|
||||||
|
|
||||||
result = (Node *) makeBoolExpr(AND_EXPR,
|
result = (Node *) makeBoolExpr(AND_EXPR,
|
||||||
makeList2(lexpr,
|
list_make2(lexpr,
|
||||||
rexpr));
|
rexpr));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AEXPR_OR:
|
case AEXPR_OR:
|
||||||
|
@ -299,8 +299,8 @@ transformExpr(ParseState *pstate, Node *expr)
|
||||||
rexpr = coerce_to_boolean(pstate, rexpr, "OR");
|
rexpr = coerce_to_boolean(pstate, rexpr, "OR");
|
||||||
|
|
||||||
result = (Node *) makeBoolExpr(OR_EXPR,
|
result = (Node *) makeBoolExpr(OR_EXPR,
|
||||||
makeList2(lexpr,
|
list_make2(lexpr,
|
||||||
rexpr));
|
rexpr));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AEXPR_NOT:
|
case AEXPR_NOT:
|
||||||
|
@ -311,7 +311,7 @@ transformExpr(ParseState *pstate, Node *expr)
|
||||||
rexpr = coerce_to_boolean(pstate, rexpr, "NOT");
|
rexpr = coerce_to_boolean(pstate, rexpr, "NOT");
|
||||||
|
|
||||||
result = (Node *) makeBoolExpr(NOT_EXPR,
|
result = (Node *) makeBoolExpr(NOT_EXPR,
|
||||||
makeList1(rexpr));
|
list_make1(rexpr));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AEXPR_OP_ANY:
|
case AEXPR_OP_ANY:
|
||||||
|
@ -446,7 +446,7 @@ transformExpr(ParseState *pstate, Node *expr)
|
||||||
* XXX: repeated lappend() would no longer result in
|
* XXX: repeated lappend() would no longer result in
|
||||||
* O(n^2) behavior; worth reconsidering this design?
|
* O(n^2) behavior; worth reconsidering this design?
|
||||||
*/
|
*/
|
||||||
targs = listCopy(fn->args);
|
targs = list_copy(fn->args);
|
||||||
foreach(args, targs)
|
foreach(args, targs)
|
||||||
{
|
{
|
||||||
lfirst(args) = transformExpr(pstate,
|
lfirst(args) = transformExpr(pstate,
|
||||||
|
@ -474,7 +474,7 @@ transformExpr(ParseState *pstate, Node *expr)
|
||||||
}
|
}
|
||||||
pstate->p_hasSubLinks = true;
|
pstate->p_hasSubLinks = true;
|
||||||
qtrees = parse_sub_analyze(sublink->subselect, pstate);
|
qtrees = parse_sub_analyze(sublink->subselect, pstate);
|
||||||
if (length(qtrees) != 1)
|
if (list_length(qtrees) != 1)
|
||||||
elog(ERROR, "bad query in sub-select");
|
elog(ERROR, "bad query in sub-select");
|
||||||
qtree = (Query *) linitial(qtrees);
|
qtree = (Query *) linitial(qtrees);
|
||||||
if (qtree->commandType != CMD_SELECT ||
|
if (qtree->commandType != CMD_SELECT ||
|
||||||
|
@ -530,7 +530,7 @@ transformExpr(ParseState *pstate, Node *expr)
|
||||||
/* ALL, ANY, or MULTIEXPR: generate operator list */
|
/* ALL, ANY, or MULTIEXPR: generate operator list */
|
||||||
List *left_list = sublink->lefthand;
|
List *left_list = sublink->lefthand;
|
||||||
List *right_list = qtree->targetList;
|
List *right_list = qtree->targetList;
|
||||||
int row_length = length(left_list);
|
int row_length = list_length(left_list);
|
||||||
bool needNot = false;
|
bool needNot = false;
|
||||||
List *op = sublink->operName;
|
List *op = sublink->operName;
|
||||||
char *opname = strVal(llast(op));
|
char *opname = strVal(llast(op));
|
||||||
|
@ -548,11 +548,11 @@ transformExpr(ParseState *pstate, Node *expr)
|
||||||
* pre-7.4 Postgres.
|
* pre-7.4 Postgres.
|
||||||
*/
|
*/
|
||||||
if (sublink->subLinkType == ALL_SUBLINK &&
|
if (sublink->subLinkType == ALL_SUBLINK &&
|
||||||
length(op) == 1 && strcmp(opname, "<>") == 0)
|
list_length(op) == 1 && strcmp(opname, "<>") == 0)
|
||||||
{
|
{
|
||||||
sublink->subLinkType = ANY_SUBLINK;
|
sublink->subLinkType = ANY_SUBLINK;
|
||||||
opname = pstrdup("=");
|
opname = pstrdup("=");
|
||||||
op = makeList1(makeString(opname));
|
op = list_make1(makeString(opname));
|
||||||
sublink->operName = op;
|
sublink->operName = op;
|
||||||
needNot = true;
|
needNot = true;
|
||||||
}
|
}
|
||||||
|
@ -626,8 +626,8 @@ transformExpr(ParseState *pstate, Node *expr)
|
||||||
opname),
|
opname),
|
||||||
errhint("The operator of a quantified predicate subquery must return type boolean.")));
|
errhint("The operator of a quantified predicate subquery must return type boolean.")));
|
||||||
|
|
||||||
sublink->operOids = lappendo(sublink->operOids,
|
sublink->operOids = lappend_oid(sublink->operOids,
|
||||||
oprid(optup));
|
oprid(optup));
|
||||||
|
|
||||||
ReleaseSysCache(optup);
|
ReleaseSysCache(optup);
|
||||||
}
|
}
|
||||||
|
@ -640,7 +640,7 @@ transformExpr(ParseState *pstate, Node *expr)
|
||||||
{
|
{
|
||||||
expr = coerce_to_boolean(pstate, expr, "NOT");
|
expr = coerce_to_boolean(pstate, expr, "NOT");
|
||||||
expr = (Node *) makeBoolExpr(NOT_EXPR,
|
expr = (Node *) makeBoolExpr(NOT_EXPR,
|
||||||
makeList1(expr));
|
list_make1(expr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = (Node *) expr;
|
result = (Node *) expr;
|
||||||
|
@ -709,7 +709,7 @@ transformExpr(ParseState *pstate, Node *expr)
|
||||||
neww->result = (Expr *) transformExpr(pstate, warg);
|
neww->result = (Expr *) transformExpr(pstate, warg);
|
||||||
|
|
||||||
newargs = lappend(newargs, neww);
|
newargs = lappend(newargs, neww);
|
||||||
typeids = lappendo(typeids, exprType((Node *) neww->result));
|
typeids = lappend_oid(typeids, exprType((Node *) neww->result));
|
||||||
}
|
}
|
||||||
|
|
||||||
newc->args = newargs;
|
newc->args = newargs;
|
||||||
|
@ -731,7 +731,7 @@ transformExpr(ParseState *pstate, Node *expr)
|
||||||
* code worked before, but it seems a little bogus to me
|
* code worked before, but it seems a little bogus to me
|
||||||
* --- tgl
|
* --- tgl
|
||||||
*/
|
*/
|
||||||
typeids = lconso(exprType((Node *) newc->defresult), typeids);
|
typeids = lcons_oid(exprType((Node *) newc->defresult), typeids);
|
||||||
|
|
||||||
ptype = select_common_type(typeids, "CASE");
|
ptype = select_common_type(typeids, "CASE");
|
||||||
Assert(OidIsValid(ptype));
|
Assert(OidIsValid(ptype));
|
||||||
|
@ -779,7 +779,7 @@ transformExpr(ParseState *pstate, Node *expr)
|
||||||
|
|
||||||
newe = transformExpr(pstate, e);
|
newe = transformExpr(pstate, e);
|
||||||
newelems = lappend(newelems, newe);
|
newelems = lappend(newelems, newe);
|
||||||
typeids = lappendo(typeids, exprType(newe));
|
typeids = lappend_oid(typeids, exprType(newe));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Select a common type for the elements */
|
/* Select a common type for the elements */
|
||||||
|
@ -868,7 +868,7 @@ transformExpr(ParseState *pstate, Node *expr)
|
||||||
|
|
||||||
newe = transformExpr(pstate, e);
|
newe = transformExpr(pstate, e);
|
||||||
newargs = lappend(newargs, newe);
|
newargs = lappend(newargs, newe);
|
||||||
typeids = lappendo(typeids, exprType(newe));
|
typeids = lappend_oid(typeids, exprType(newe));
|
||||||
}
|
}
|
||||||
|
|
||||||
newc->coalescetype = select_common_type(typeids, "COALESCE");
|
newc->coalescetype = select_common_type(typeids, "COALESCE");
|
||||||
|
@ -997,7 +997,7 @@ transformIndirection(ParseState *pstate, Node *basenode, List *indirection)
|
||||||
static Node *
|
static Node *
|
||||||
transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
||||||
{
|
{
|
||||||
int numnames = length(cref->fields);
|
int numnames = list_length(cref->fields);
|
||||||
Node *node;
|
Node *node;
|
||||||
int levels_up;
|
int levels_up;
|
||||||
|
|
||||||
|
@ -1095,8 +1095,8 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
||||||
*/
|
*/
|
||||||
node = transformWholeRowRef(pstate, NULL, name1);
|
node = transformWholeRowRef(pstate, NULL, name1);
|
||||||
node = ParseFuncOrColumn(pstate,
|
node = ParseFuncOrColumn(pstate,
|
||||||
makeList1(makeString(name2)),
|
list_make1(makeString(name2)),
|
||||||
makeList1(node),
|
list_make1(node),
|
||||||
false, false, true);
|
false, false, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1121,8 +1121,8 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
||||||
/* Try it as a function call */
|
/* Try it as a function call */
|
||||||
node = transformWholeRowRef(pstate, name1, name2);
|
node = transformWholeRowRef(pstate, name1, name2);
|
||||||
node = ParseFuncOrColumn(pstate,
|
node = ParseFuncOrColumn(pstate,
|
||||||
makeList1(makeString(name3)),
|
list_make1(makeString(name3)),
|
||||||
makeList1(node),
|
list_make1(node),
|
||||||
false, false, true);
|
false, false, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1157,8 +1157,8 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
||||||
/* Try it as a function call */
|
/* Try it as a function call */
|
||||||
node = transformWholeRowRef(pstate, name2, name3);
|
node = transformWholeRowRef(pstate, name2, name3);
|
||||||
node = ParseFuncOrColumn(pstate,
|
node = ParseFuncOrColumn(pstate,
|
||||||
makeList1(makeString(name4)),
|
list_make1(makeString(name4)),
|
||||||
makeList1(node),
|
list_make1(node),
|
||||||
false, false, true);
|
false, false, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1587,7 +1587,7 @@ exprIsLengthCoercion(Node *expr, int32 *coercedTypmod)
|
||||||
* second argument being an int4 constant, it can't have been created
|
* second argument being an int4 constant, it can't have been created
|
||||||
* from a length coercion (it must be a type coercion, instead).
|
* 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)
|
if (nargs < 2 || nargs > 3)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1661,7 +1661,7 @@ make_row_op(ParseState *pstate, List *opname, Node *ltree, Node *rtree)
|
||||||
largs = lrow->args;
|
largs = lrow->args;
|
||||||
rargs = rrow->args;
|
rargs = rrow->args;
|
||||||
|
|
||||||
if (length(largs) != length(rargs))
|
if (list_length(largs) != list_length(rargs))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
errmsg("unequal number of entries in row expression")));
|
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;
|
result = cmp;
|
||||||
else
|
else
|
||||||
result = (Node *) makeBoolExpr(boolop,
|
result = (Node *) makeBoolExpr(boolop,
|
||||||
makeList2(result, cmp));
|
list_make2(result, cmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
|
@ -1744,7 +1744,7 @@ make_row_distinct_op(ParseState *pstate, List *opname,
|
||||||
largs = lrow->args;
|
largs = lrow->args;
|
||||||
rargs = rrow->args;
|
rargs = rrow->args;
|
||||||
|
|
||||||
if (length(largs) != length(rargs))
|
if (list_length(largs) != list_length(rargs))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
errmsg("unequal number of entries in row expression")));
|
errmsg("unequal number of entries in row expression")));
|
||||||
|
@ -1760,7 +1760,7 @@ make_row_distinct_op(ParseState *pstate, List *opname,
|
||||||
result = cmp;
|
result = cmp;
|
||||||
else
|
else
|
||||||
result = (Node *) makeBoolExpr(OR_EXPR,
|
result = (Node *) makeBoolExpr(OR_EXPR,
|
||||||
makeList2(result, cmp));
|
list_make2(result, cmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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;
|
Oid funcid;
|
||||||
ListCell *l;
|
ListCell *l;
|
||||||
Node *first_arg = NULL;
|
Node *first_arg = NULL;
|
||||||
int nargs = length(fargs);
|
int nargs = list_length(fargs);
|
||||||
int argn;
|
int argn;
|
||||||
Oid actual_arg_types[FUNC_MAX_ARGS];
|
Oid actual_arg_types[FUNC_MAX_ARGS];
|
||||||
Oid *declared_arg_types;
|
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
|
* then the "function call" could be a projection. We also check that
|
||||||
* there wasn't any aggregate decoration.
|
* 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);
|
Oid argtype = exprType(first_arg);
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
|
||||||
if (is_column)
|
if (is_column)
|
||||||
{
|
{
|
||||||
Assert(nargs == 1);
|
Assert(nargs == 1);
|
||||||
Assert(length(funcname) == 1);
|
Assert(list_length(funcname) == 1);
|
||||||
unknown_attribute(pstate, first_arg, strVal(linitial(funcname)));
|
unknown_attribute(pstate, first_arg, strVal(linitial(funcname)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -974,8 +974,8 @@ find_inheritors(Oid relid, Oid **supervec)
|
||||||
else
|
else
|
||||||
*supervec = NULL;
|
*supervec = NULL;
|
||||||
|
|
||||||
freeList(visited);
|
list_free(visited);
|
||||||
freeList(queue);
|
list_free(queue);
|
||||||
|
|
||||||
return nvisited;
|
return nvisited;
|
||||||
}
|
}
|
||||||
|
@ -1400,7 +1400,7 @@ LookupFuncNameTypeNames(List *funcname, List *argtypes, bool noError)
|
||||||
ListCell *args_item;
|
ListCell *args_item;
|
||||||
|
|
||||||
MemSet(argoids, 0, FUNC_MAX_ARGS * sizeof(Oid));
|
MemSet(argoids, 0, FUNC_MAX_ARGS * sizeof(Oid));
|
||||||
argcount = length(argtypes);
|
argcount = list_length(argtypes);
|
||||||
if (argcount > FUNC_MAX_ARGS)
|
if (argcount > FUNC_MAX_ARGS)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_TOO_MANY_ARGUMENTS),
|
(errcode(ERRCODE_TOO_MANY_ARGUMENTS),
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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);
|
tup = oper(opname, ltypeId, rtypeId, false);
|
||||||
opform = (Form_pg_operator) GETSTRUCT(tup);
|
opform = (Form_pg_operator) GETSTRUCT(tup);
|
||||||
|
|
||||||
args = makeList2(ltree, rtree);
|
args = list_make2(ltree, rtree);
|
||||||
actual_arg_types[0] = ltypeId;
|
actual_arg_types[0] = ltypeId;
|
||||||
actual_arg_types[1] = rtypeId;
|
actual_arg_types[1] = rtypeId;
|
||||||
declared_arg_types[0] = opform->oprleft;
|
declared_arg_types[0] = opform->oprleft;
|
||||||
|
@ -960,7 +960,7 @@ make_op_expr(ParseState *pstate, Operator op,
|
||||||
if (rtree == NULL)
|
if (rtree == NULL)
|
||||||
{
|
{
|
||||||
/* right operator */
|
/* right operator */
|
||||||
args = makeList1(ltree);
|
args = list_make1(ltree);
|
||||||
actual_arg_types[0] = ltypeId;
|
actual_arg_types[0] = ltypeId;
|
||||||
declared_arg_types[0] = opform->oprleft;
|
declared_arg_types[0] = opform->oprleft;
|
||||||
nargs = 1;
|
nargs = 1;
|
||||||
|
@ -968,7 +968,7 @@ make_op_expr(ParseState *pstate, Operator op,
|
||||||
else if (ltree == NULL)
|
else if (ltree == NULL)
|
||||||
{
|
{
|
||||||
/* left operator */
|
/* left operator */
|
||||||
args = makeList1(rtree);
|
args = list_make1(rtree);
|
||||||
actual_arg_types[0] = rtypeId;
|
actual_arg_types[0] = rtypeId;
|
||||||
declared_arg_types[0] = opform->oprright;
|
declared_arg_types[0] = opform->oprright;
|
||||||
nargs = 1;
|
nargs = 1;
|
||||||
|
@ -976,7 +976,7 @@ make_op_expr(ParseState *pstate, Operator op,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* otherwise, binary operator */
|
/* otherwise, binary operator */
|
||||||
args = makeList2(ltree, rtree);
|
args = list_make2(ltree, rtree);
|
||||||
actual_arg_types[0] = ltypeId;
|
actual_arg_types[0] = ltypeId;
|
||||||
actual_arg_types[1] = rtypeId;
|
actual_arg_types[1] = rtypeId;
|
||||||
declared_arg_types[0] = opform->oprleft;
|
declared_arg_types[0] = opform->oprleft;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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;
|
pstate = pstate->parentParseState;
|
||||||
Assert(pstate != NULL);
|
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);
|
return rt_fetch(varno, pstate->p_rtable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -674,7 +674,7 @@ addRangeTableEntry(ParseState *pstate,
|
||||||
rte->relid = RelationGetRelid(rel);
|
rte->relid = RelationGetRelid(rel);
|
||||||
|
|
||||||
eref = alias ? (Alias *) copyObject(alias) : makeAlias(refname, NIL);
|
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
|
* Since the rel is open anyway, let's check that the number of column
|
||||||
|
@ -768,7 +768,7 @@ addRangeTableEntryForRelation(ParseState *pstate,
|
||||||
rte->relid = relid;
|
rte->relid = relid;
|
||||||
|
|
||||||
eref = (Alias *) copyObject(alias);
|
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
|
* Since the rel is open anyway, let's check that the number of column
|
||||||
|
@ -849,7 +849,7 @@ addRangeTableEntryForSubquery(ParseState *pstate,
|
||||||
rte->alias = alias;
|
rte->alias = alias;
|
||||||
|
|
||||||
eref = copyObject(alias);
|
eref = copyObject(alias);
|
||||||
numaliases = length(eref->colnames);
|
numaliases = list_length(eref->colnames);
|
||||||
|
|
||||||
/* fill in any unspecified alias columns */
|
/* fill in any unspecified alias columns */
|
||||||
varattno = 0;
|
varattno = 0;
|
||||||
|
@ -933,7 +933,7 @@ addRangeTableEntryForFunction(ParseState *pstate,
|
||||||
eref = alias ? (Alias *) copyObject(alias) : makeAlias(funcname, NIL);
|
eref = alias ? (Alias *) copyObject(alias) : makeAlias(funcname, NIL);
|
||||||
rte->eref = eref;
|
rte->eref = eref;
|
||||||
|
|
||||||
numaliases = length(eref->colnames);
|
numaliases = list_length(eref->colnames);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now determine if the function returns a simple or composite type,
|
* 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",
|
errmsg("too many column aliases specified for function %s",
|
||||||
funcname)));
|
funcname)));
|
||||||
if (numaliases == 0)
|
if (numaliases == 0)
|
||||||
eref->colnames = makeList1(makeString(eref->aliasname));
|
eref->colnames = list_make1(makeString(eref->aliasname));
|
||||||
}
|
}
|
||||||
else if (functyptype == 'p' && funcrettype == RECORDOID)
|
else if (functyptype == 'p' && funcrettype == RECORDOID)
|
||||||
{
|
{
|
||||||
|
@ -1097,12 +1097,12 @@ addRangeTableEntryForJoin(ParseState *pstate,
|
||||||
rte->alias = alias;
|
rte->alias = alias;
|
||||||
|
|
||||||
eref = alias ? (Alias *) copyObject(alias) : makeAlias("unnamed_join", NIL);
|
eref = alias ? (Alias *) copyObject(alias) : makeAlias("unnamed_join", NIL);
|
||||||
numaliases = length(eref->colnames);
|
numaliases = list_length(eref->colnames);
|
||||||
|
|
||||||
/* fill in any unspecified alias columns */
|
/* fill in any unspecified alias columns */
|
||||||
if (numaliases < length(colnames))
|
if (numaliases < list_length(colnames))
|
||||||
eref->colnames = nconc(eref->colnames,
|
eref->colnames = list_concat(eref->colnames,
|
||||||
list_copy_tail(colnames, numaliases));
|
list_copy_tail(colnames, numaliases));
|
||||||
|
|
||||||
rte->eref = eref;
|
rte->eref = eref;
|
||||||
|
|
||||||
|
@ -1241,7 +1241,7 @@ expandRTE(ParseState *pstate, RangeTblEntry *rte,
|
||||||
|
|
||||||
rel = heap_open(rte->relid, AccessShareLock);
|
rel = heap_open(rte->relid, AccessShareLock);
|
||||||
maxattrs = RelationGetNumberOfAttributes(rel);
|
maxattrs = RelationGetNumberOfAttributes(rel);
|
||||||
numaliases = length(rte->eref->colnames);
|
numaliases = list_length(rte->eref->colnames);
|
||||||
|
|
||||||
for (varattno = 0; varattno < maxattrs; varattno++)
|
for (varattno = 0; varattno < maxattrs; varattno++)
|
||||||
{
|
{
|
||||||
|
@ -1255,7 +1255,7 @@ expandRTE(ParseState *pstate, RangeTblEntry *rte,
|
||||||
char *label;
|
char *label;
|
||||||
|
|
||||||
if (varattno < numaliases)
|
if (varattno < numaliases)
|
||||||
label = strVal(nth(varattno, rte->eref->colnames));
|
label = strVal(list_nth(rte->eref->colnames, varattno));
|
||||||
else
|
else
|
||||||
label = NameStr(attr->attname);
|
label = NameStr(attr->attname);
|
||||||
*colnames = lappend(*colnames, makeString(pstrdup(label)));
|
*colnames = lappend(*colnames, makeString(pstrdup(label)));
|
||||||
|
@ -1339,7 +1339,7 @@ expandRTE(ParseState *pstate, RangeTblEntry *rte,
|
||||||
|
|
||||||
rel = relation_open(funcrelid, AccessShareLock);
|
rel = relation_open(funcrelid, AccessShareLock);
|
||||||
maxattrs = RelationGetNumberOfAttributes(rel);
|
maxattrs = RelationGetNumberOfAttributes(rel);
|
||||||
numaliases = length(rte->eref->colnames);
|
numaliases = list_length(rte->eref->colnames);
|
||||||
|
|
||||||
for (varattno = 0; varattno < maxattrs; varattno++)
|
for (varattno = 0; varattno < maxattrs; varattno++)
|
||||||
{
|
{
|
||||||
|
@ -1353,7 +1353,7 @@ expandRTE(ParseState *pstate, RangeTblEntry *rte,
|
||||||
char *label;
|
char *label;
|
||||||
|
|
||||||
if (varattno < numaliases)
|
if (varattno < numaliases)
|
||||||
label = strVal(nth(varattno, rte->eref->colnames));
|
label = strVal(list_nth(rte->eref->colnames, varattno));
|
||||||
else
|
else
|
||||||
label = NameStr(attr->attname);
|
label = NameStr(attr->attname);
|
||||||
*colnames = lappend(*colnames, makeString(pstrdup(label)));
|
*colnames = lappend(*colnames, makeString(pstrdup(label)));
|
||||||
|
@ -1442,7 +1442,7 @@ expandRTE(ParseState *pstate, RangeTblEntry *rte,
|
||||||
ListCell *colname;
|
ListCell *colname;
|
||||||
ListCell *aliasvar;
|
ListCell *aliasvar;
|
||||||
|
|
||||||
Assert(length(rte->eref->colnames) == length(rte->joinaliasvars));
|
Assert(list_length(rte->eref->colnames) == list_length(rte->joinaliasvars));
|
||||||
|
|
||||||
varattno = 0;
|
varattno = 0;
|
||||||
forboth (colname, rte->eref->colnames, aliasvar, rte->joinaliasvars)
|
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 there is a user-written column alias, use it.
|
||||||
*/
|
*/
|
||||||
if (rte->alias &&
|
if (rte->alias &&
|
||||||
attnum > 0 && attnum <= length(rte->alias->colnames))
|
attnum > 0 && attnum <= list_length(rte->alias->colnames))
|
||||||
return strVal(nth(attnum - 1, 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
|
* 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
|
* Otherwise use the column name from eref. There should always be
|
||||||
* one.
|
* one.
|
||||||
*/
|
*/
|
||||||
if (attnum > 0 && attnum <= length(rte->eref->colnames))
|
if (attnum > 0 && attnum <= list_length(rte->eref->colnames))
|
||||||
return strVal(nth(attnum - 1, rte->eref->colnames));
|
return strVal(list_nth(rte->eref->colnames, attnum - 1));
|
||||||
|
|
||||||
/* else caller gave us a bogus attnum */
|
/* else caller gave us a bogus attnum */
|
||||||
elog(ERROR, "invalid attnum %d for rangetable entry %s",
|
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)
|
else if (functyptype == 'p' && funcrettype == RECORDOID)
|
||||||
{
|
{
|
||||||
ColumnDef *colDef = nth(attnum - 1, coldeflist);
|
ColumnDef *colDef = list_nth(coldeflist, attnum - 1);
|
||||||
|
|
||||||
*vartype = typenameTypeId(colDef->typename);
|
*vartype = typenameTypeId(colDef->typename);
|
||||||
*vartypmod = -1;
|
*vartypmod = -1;
|
||||||
|
@ -1684,8 +1684,8 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
|
||||||
*/
|
*/
|
||||||
Node *aliasvar;
|
Node *aliasvar;
|
||||||
|
|
||||||
Assert(attnum > 0 && attnum <= length(rte->joinaliasvars));
|
Assert(attnum > 0 && attnum <= list_length(rte->joinaliasvars));
|
||||||
aliasvar = (Node *) nth(attnum - 1, rte->joinaliasvars);
|
aliasvar = (Node *) list_nth(rte->joinaliasvars, attnum - 1);
|
||||||
*vartype = exprType(aliasvar);
|
*vartype = exprType(aliasvar);
|
||||||
*vartypmod = exprTypmod(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.
|
* Returns NULL if resno is not present in list.
|
||||||
*
|
*
|
||||||
* Note: we need to search, rather than just indexing with nth(), because
|
* Note: we need to search, rather than just indexing with list_nth(),
|
||||||
* not all tlists are sorted by resno.
|
* because not all tlists are sorted by resno.
|
||||||
*/
|
*/
|
||||||
TargetEntry *
|
TargetEntry *
|
||||||
get_tle_by_resno(List *tlist, AttrNumber resno)
|
get_tle_by_resno(List *tlist, AttrNumber resno)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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)
|
if (strcmp(strVal(llast(fields)), "*") == 0)
|
||||||
{
|
{
|
||||||
int numnames = length(fields);
|
int numnames = list_length(fields);
|
||||||
|
|
||||||
if (numnames == 1)
|
if (numnames == 1)
|
||||||
{
|
{
|
||||||
|
@ -268,8 +268,8 @@ markTargetListOrigin(ParseState *pstate, Resdom *res, Var *var)
|
||||||
/* Join RTE --- recursively inspect the alias variable */
|
/* Join RTE --- recursively inspect the alias variable */
|
||||||
Var *aliasvar;
|
Var *aliasvar;
|
||||||
|
|
||||||
Assert(attnum > 0 && attnum <= length(rte->joinaliasvars));
|
Assert(attnum > 0 && attnum <= list_length(rte->joinaliasvars));
|
||||||
aliasvar = (Var *) nth(attnum - 1, rte->joinaliasvars);
|
aliasvar = (Var *) list_nth(rte->joinaliasvars, attnum - 1);
|
||||||
markTargetListOrigin(pstate, res, aliasvar);
|
markTargetListOrigin(pstate, res, aliasvar);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -460,7 +460,7 @@ checkInsertTargets(ParseState *pstate, List *cols, List **attrnos)
|
||||||
col->indirection = NIL;
|
col->indirection = NIL;
|
||||||
col->val = NULL;
|
col->val = NULL;
|
||||||
cols = lappend(cols, col);
|
cols = lappend(cols, col);
|
||||||
*attrnos = lappendi(*attrnos, i + 1);
|
*attrnos = lappend_int(*attrnos, i + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -478,12 +478,12 @@ checkInsertTargets(ParseState *pstate, List *cols, List **attrnos)
|
||||||
/* Lookup column name, ereport on failure */
|
/* Lookup column name, ereport on failure */
|
||||||
attrno = attnameAttNum(pstate->p_target_relation, name, false);
|
attrno = attnameAttNum(pstate->p_target_relation, name, false);
|
||||||
/* Check for duplicates */
|
/* Check for duplicates */
|
||||||
if (intMember(attrno, *attrnos))
|
if (list_member_int(*attrnos, attrno))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DUPLICATE_COLUMN),
|
(errcode(ERRCODE_DUPLICATE_COLUMN),
|
||||||
errmsg("column \"%s\" specified more than once",
|
errmsg("column \"%s\" specified more than once",
|
||||||
name)));
|
name)));
|
||||||
*attrnos = lappendi(*attrnos, attrno);
|
*attrnos = lappend_int(*attrnos, attrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,7 +529,7 @@ ExpandAllTables(ParseState *pstate)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
found_table = true;
|
found_table = true;
|
||||||
target = nconc(target, expandRelAttrs(pstate, rte));
|
target = list_concat(target, expandRelAttrs(pstate, rte));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for SELECT *; */
|
/* Check for SELECT *; */
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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;
|
AttrNumber attnum;
|
||||||
|
|
||||||
/* deconstruct the name list */
|
/* deconstruct the name list */
|
||||||
switch (length(typename->names))
|
switch (list_length(typename->names))
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
ereport(ERROR,
|
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;
|
* Make sure we got back exactly what we expected and no more;
|
||||||
* paranoia is justified since the string might contain anything.
|
* paranoia is justified since the string might contain anything.
|
||||||
*/
|
*/
|
||||||
if (length(raw_parsetree_list) != 1)
|
if (list_length(raw_parsetree_list) != 1)
|
||||||
goto fail;
|
goto fail;
|
||||||
stmt = (SelectStmt *) linitial(raw_parsetree_list);
|
stmt = (SelectStmt *) linitial(raw_parsetree_list);
|
||||||
if (stmt == NULL ||
|
if (stmt == NULL ||
|
||||||
|
@ -503,7 +503,7 @@ parseTypeString(const char *str, Oid *type_id, int32 *typmod)
|
||||||
stmt->forUpdate != NIL ||
|
stmt->forUpdate != NIL ||
|
||||||
stmt->op != SETOP_NONE)
|
stmt->op != SETOP_NONE)
|
||||||
goto fail;
|
goto fail;
|
||||||
if (length(stmt->targetList) != 1)
|
if (list_length(stmt->targetList) != 1)
|
||||||
goto fail;
|
goto fail;
|
||||||
restarget = (ResTarget *) linitial(stmt->targetList);
|
restarget = (ResTarget *) linitial(stmt->targetList);
|
||||||
if (restarget == NULL ||
|
if (restarget == NULL ||
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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, ...
|
* So there cannot be INSTEAD NOTHING, ...
|
||||||
*/
|
*/
|
||||||
if (length(action) == 0)
|
if (list_length(action) == 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
errmsg("INSTEAD NOTHING rules on SELECT are not implemented"),
|
errmsg("INSTEAD NOTHING rules on SELECT are not implemented"),
|
||||||
|
@ -260,7 +260,7 @@ DefineQueryRewrite(RuleStmt *stmt)
|
||||||
/*
|
/*
|
||||||
* ... there cannot be multiple actions, ...
|
* ... there cannot be multiple actions, ...
|
||||||
*/
|
*/
|
||||||
if (length(action) > 1)
|
if (list_length(action) > 1)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
errmsg("multiple actions for rules on SELECT are not implemented")));
|
errmsg("multiple actions for rules on SELECT are not implemented")));
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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);
|
rule_qual = (Node *) copyObject(rule_qual);
|
||||||
|
|
||||||
current_varno = rt_index;
|
current_varno = rt_index;
|
||||||
rt_length = length(parsetree->rtable);
|
rt_length = list_length(parsetree->rtable);
|
||||||
new_varno = PRS2_NEW_VARNO + rt_length;
|
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
|
* that rule action's rtable is separate and shares no substructure
|
||||||
* with the main rtable. Hence do a deep copy here.
|
* 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);
|
sub_action->rtable);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -174,7 +174,7 @@ rewriteRuleAction(Query *parsetree,
|
||||||
errmsg("conditional UNION/INTERSECT/EXCEPT statements are not implemented")));
|
errmsg("conditional UNION/INTERSECT/EXCEPT statements are not implemented")));
|
||||||
|
|
||||||
sub_action->jointree->fromlist =
|
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) &&
|
if (IsA(rtr, RangeTblRef) &&
|
||||||
rtr->rtindex == rt_index)
|
rtr->rtindex == rt_index)
|
||||||
{
|
{
|
||||||
newjointree = lremove(rtr, newjointree);
|
newjointree = list_delete_ptr(newjointree, rtr);
|
||||||
/* foreach is safe because we exit loop after lremove... */
|
/* foreach is safe because we exit loop after list_delete... */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -616,7 +616,7 @@ ApplyRetrieveRule(Query *parsetree,
|
||||||
RangeTblEntry *rte,
|
RangeTblEntry *rte,
|
||||||
*subrte;
|
*subrte;
|
||||||
|
|
||||||
if (length(rule->actions) != 1)
|
if (list_length(rule->actions) != 1)
|
||||||
elog(ERROR, "expected just one rule action");
|
elog(ERROR, "expected just one rule action");
|
||||||
if (rule->qual != NULL)
|
if (rule->qual != NULL)
|
||||||
elog(ERROR, "cannot handle qualified ON SELECT rule");
|
elog(ERROR, "cannot handle qualified ON SELECT rule");
|
||||||
|
@ -657,14 +657,14 @@ ApplyRetrieveRule(Query *parsetree,
|
||||||
/*
|
/*
|
||||||
* FOR UPDATE of view?
|
* 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
|
* Remove the view from the list of rels that will actually be
|
||||||
* marked FOR UPDATE by the executor. It will still be access-
|
* marked FOR UPDATE by the executor. It will still be access-
|
||||||
* checked for write access, though.
|
* 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.
|
* 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 (rte->rtekind == RTE_RELATION)
|
||||||
{
|
{
|
||||||
if (!intMember(rti, qry->rowMarks))
|
if (!list_member_int(qry->rowMarks, rti))
|
||||||
qry->rowMarks = lappendi(qry->rowMarks, rti);
|
qry->rowMarks = lappend_int(qry->rowMarks, rti);
|
||||||
rte->requiredPerms |= ACL_SELECT_FOR_UPDATE;
|
rte->requiredPerms |= ACL_SELECT_FOR_UPDATE;
|
||||||
}
|
}
|
||||||
else if (rte->rtekind == RTE_SUBQUERY)
|
else if (rte->rtekind == RTE_SUBQUERY)
|
||||||
|
@ -766,7 +766,7 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
|
||||||
* can get changed each time through...
|
* can get changed each time through...
|
||||||
*/
|
*/
|
||||||
rt_index = 0;
|
rt_index = 0;
|
||||||
while (rt_index < length(parsetree->rtable))
|
while (rt_index < list_length(parsetree->rtable))
|
||||||
{
|
{
|
||||||
RangeTblEntry *rte;
|
RangeTblEntry *rte;
|
||||||
Relation rel;
|
Relation rel;
|
||||||
|
@ -825,7 +825,7 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
|
||||||
*/
|
*/
|
||||||
if (rt_index == parsetree->resultRelation)
|
if (rt_index == parsetree->resultRelation)
|
||||||
lockmode = NoLock;
|
lockmode = NoLock;
|
||||||
else if (intMember(rt_index, parsetree->rowMarks))
|
else if (list_member_int(parsetree->rowMarks, rt_index))
|
||||||
lockmode = RowShareLock;
|
lockmode = RowShareLock;
|
||||||
else
|
else
|
||||||
lockmode = AccessShareLock;
|
lockmode = AccessShareLock;
|
||||||
|
@ -866,12 +866,12 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
|
||||||
{
|
{
|
||||||
ListCell *l;
|
ListCell *l;
|
||||||
|
|
||||||
if (oidMember(RelationGetRelid(rel), activeRIRs))
|
if (list_member_oid(activeRIRs, RelationGetRelid(rel)))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||||
errmsg("infinite recursion detected in rules for relation \"%s\"",
|
errmsg("infinite recursion detected in rules for relation \"%s\"",
|
||||||
RelationGetRelationName(rel))));
|
RelationGetRelationName(rel))));
|
||||||
activeRIRs = lconso(RelationGetRelid(rel), activeRIRs);
|
activeRIRs = lcons_oid(RelationGetRelid(rel), activeRIRs);
|
||||||
|
|
||||||
foreach(l, locks)
|
foreach(l, locks)
|
||||||
{
|
{
|
||||||
|
@ -1169,7 +1169,7 @@ RewriteQuery(Query *parsetree, List *rewrite_events)
|
||||||
List *newstuff;
|
List *newstuff;
|
||||||
|
|
||||||
newstuff = RewriteQuery(pt, rewrite_events);
|
newstuff = RewriteQuery(pt, rewrite_events);
|
||||||
rewritten = nconc(rewritten, newstuff);
|
rewritten = list_concat(rewritten, newstuff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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)
|
if (qry->resultRelation)
|
||||||
qry->resultRelation += offset;
|
qry->resultRelation += offset;
|
||||||
foreach(l, qry->rowMarks)
|
foreach(l, qry->rowMarks)
|
||||||
lfirsti(l) += offset;
|
lfirst_int(l) += offset;
|
||||||
}
|
}
|
||||||
query_tree_walker(qry, OffsetVarNodes_walker,
|
query_tree_walker(qry, OffsetVarNodes_walker,
|
||||||
(void *) &context, 0);
|
(void *) &context, 0);
|
||||||
|
@ -373,8 +373,8 @@ ChangeVarNodes(Node *node, int rt_index, int new_index, int sublevels_up)
|
||||||
qry->resultRelation = new_index;
|
qry->resultRelation = new_index;
|
||||||
foreach(l, qry->rowMarks)
|
foreach(l, qry->rowMarks)
|
||||||
{
|
{
|
||||||
if (lfirsti(l) == rt_index)
|
if (lfirst_int(l) == rt_index)
|
||||||
lfirsti(l) = new_index;
|
lfirst_int(l) = new_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
query_tree_walker(qry, ChangeVarNodes_walker,
|
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
|
* query. If they're not there, it must be an INSERT/SELECT in which
|
||||||
* they've been pushed down to the SELECT.
|
* 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,
|
strcmp(rt_fetch(PRS2_OLD_VARNO, parsetree->rtable)->eref->aliasname,
|
||||||
"*OLD*") == 0 &&
|
"*OLD*") == 0 &&
|
||||||
strcmp(rt_fetch(PRS2_NEW_VARNO, parsetree->rtable)->eref->aliasname,
|
strcmp(rt_fetch(PRS2_NEW_VARNO, parsetree->rtable)->eref->aliasname,
|
||||||
"*NEW*") == 0)
|
"*NEW*") == 0)
|
||||||
return parsetree;
|
return parsetree;
|
||||||
Assert(parsetree->jointree && IsA(parsetree->jointree, FromExpr));
|
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");
|
elog(ERROR, "expected to find SELECT subquery");
|
||||||
rtr = (RangeTblRef *) linitial(parsetree->jointree->fromlist);
|
rtr = (RangeTblRef *) linitial(parsetree->jointree->fromlist);
|
||||||
Assert(IsA(rtr, RangeTblRef));
|
Assert(IsA(rtr, RangeTblRef));
|
||||||
|
@ -687,7 +687,7 @@ getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr)
|
||||||
if (!(selectquery && IsA(selectquery, Query) &&
|
if (!(selectquery && IsA(selectquery, Query) &&
|
||||||
selectquery->commandType == CMD_SELECT))
|
selectquery->commandType == CMD_SELECT))
|
||||||
elog(ERROR, "expected to find SELECT subquery");
|
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,
|
strcmp(rt_fetch(PRS2_OLD_VARNO, selectquery->rtable)->eref->aliasname,
|
||||||
"*OLD*") == 0 &&
|
"*OLD*") == 0 &&
|
||||||
strcmp(rt_fetch(PRS2_NEW_VARNO, selectquery->rtable)->eref->aliasname,
|
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;
|
RangeTblEntry *rte = context->target_rte;
|
||||||
RowExpr *rowexpr;
|
RowExpr *rowexpr;
|
||||||
List *fields = NIL;
|
List *fields = NIL;
|
||||||
AttrNumber nfields = length(rte->eref->colnames);
|
AttrNumber nfields = list_length(rte->eref->colnames);
|
||||||
AttrNumber nf;
|
AttrNumber nf;
|
||||||
|
|
||||||
for (nf = 1; nf <= nfields; nf++)
|
for (nf = 1; nf <= nfields; nf++)
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 */
|
/* +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;
|
i = 0;
|
||||||
foreach(l, search_path)
|
foreach(l, search_path)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 */
|
/* Parse the argument */
|
||||||
|
|
||||||
names = textToQualifiedNameList(relation_and_attr, "int4notin");
|
names = textToQualifiedNameList(relation_and_attr, "int4notin");
|
||||||
nnames = length(names);
|
nnames = list_length(names);
|
||||||
if (nnames < 2)
|
if (nnames < 2)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_NAME),
|
(errcode(ERRCODE_INVALID_NAME),
|
||||||
errmsg("invalid name syntax"),
|
errmsg("invalid name syntax"),
|
||||||
errhint("Must provide \"relationname.columnname\".")));
|
errhint("Must provide \"relationname.columnname\".")));
|
||||||
attribute = strVal(llast(names));
|
attribute = strVal(llast(names));
|
||||||
names = ltruncate(nnames - 1, names);
|
names = list_truncate(names, nnames - 1);
|
||||||
relrv = makeRangeVarFromNameList(names);
|
relrv = makeRangeVarFromNameList(names);
|
||||||
|
|
||||||
/* Open the relation and get a relation descriptor */
|
/* Open the relation and get a relation descriptor */
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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,
|
* Would this proc be found (uniquely!) by regprocin? If not,
|
||||||
* qualify it.
|
* qualify it.
|
||||||
*/
|
*/
|
||||||
clist = FuncnameGetCandidates(makeList1(makeString(proname)), -1);
|
clist = FuncnameGetCandidates(list_make1(makeString(proname)), -1);
|
||||||
if (clist != NULL && clist->next == NULL &&
|
if (clist != NULL && clist->next == NULL &&
|
||||||
clist->oid == proid)
|
clist->oid == proid)
|
||||||
nspname = NULL;
|
nspname = NULL;
|
||||||
|
@ -536,7 +536,7 @@ regoperout(PG_FUNCTION_ARGS)
|
||||||
* Would this oper be found (uniquely!) by regoperin? If not,
|
* Would this oper be found (uniquely!) by regoperin? If not,
|
||||||
* qualify it.
|
* qualify it.
|
||||||
*/
|
*/
|
||||||
clist = OpernameGetCandidates(makeList1(makeString(oprname)),
|
clist = OpernameGetCandidates(list_make1(makeString(oprname)),
|
||||||
'\0');
|
'\0');
|
||||||
if (clist != NULL && clist->next == NULL &&
|
if (clist != NULL && clist->next == NULL &&
|
||||||
clist->oid == oprid)
|
clist->oid == oprid)
|
||||||
|
@ -1122,7 +1122,7 @@ stringToQualifiedNameList(const char *string, const char *caller)
|
||||||
}
|
}
|
||||||
|
|
||||||
pfree(rawname);
|
pfree(rawname);
|
||||||
freeList(namelist);
|
list_free(namelist);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
* 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];
|
HeapTuple tuple = SPI_tuptable->vals[0];
|
||||||
TupleDesc tupdesc = SPI_tuptable->tupdesc;
|
TupleDesc tupdesc = SPI_tuptable->tupdesc;
|
||||||
int nkeys = length(fkconstraint->fk_attrs);
|
int nkeys = list_length(fkconstraint->fk_attrs);
|
||||||
int i;
|
int i;
|
||||||
RI_QueryKey qkey;
|
RI_QueryKey qkey;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* back to source text
|
* back to source text
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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.
|
* This software is copyrighted by Jan Wieck - Hamburg.
|
||||||
*
|
*
|
||||||
|
@ -1290,12 +1290,12 @@ deparse_context_for(const char *aliasname, Oid relid)
|
||||||
rte->inFromCl = true;
|
rte->inFromCl = true;
|
||||||
|
|
||||||
/* Build one-element rtable */
|
/* Build one-element rtable */
|
||||||
dpns->rtable = makeList1(rte);
|
dpns->rtable = list_make1(rte);
|
||||||
dpns->outer_varno = dpns->inner_varno = 0;
|
dpns->outer_varno = dpns->inner_varno = 0;
|
||||||
dpns->outer_rte = dpns->inner_rte = NULL;
|
dpns->outer_rte = dpns->inner_rte = NULL;
|
||||||
|
|
||||||
/* Return a one-deep namespace stack */
|
/* 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;
|
dpns->inner_rte = (RangeTblEntry *) innercontext;
|
||||||
|
|
||||||
/* Return a one-deep namespace stack */
|
/* 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);
|
RangeTblEntry *rte = makeNode(RangeTblEntry);
|
||||||
List *attrs = NIL;
|
List *attrs = NIL;
|
||||||
int nattrs = 0;
|
int nattrs = 0;
|
||||||
int rtablelength = length(rtable);
|
int rtablelength = list_length(rtable);
|
||||||
ListCell *tl;
|
ListCell *tl;
|
||||||
char buf[32];
|
char buf[32];
|
||||||
|
|
||||||
|
@ -1539,8 +1539,8 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||||
query = getInsertSelectQuery(query, NULL);
|
query = getInsertSelectQuery(query, NULL);
|
||||||
|
|
||||||
context.buf = buf;
|
context.buf = buf;
|
||||||
context.namespaces = makeList1(&dpns);
|
context.namespaces = list_make1(&dpns);
|
||||||
context.varprefix = (length(query->rtable) != 1);
|
context.varprefix = (list_length(query->rtable) != 1);
|
||||||
context.prettyFlags = prettyFlags;
|
context.prettyFlags = prettyFlags;
|
||||||
context.indentLevel = PRETTYINDENT_STD;
|
context.indentLevel = PRETTYINDENT_STD;
|
||||||
dpns.rtable = query->rtable;
|
dpns.rtable = query->rtable;
|
||||||
|
@ -1557,7 +1557,7 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||||
appendStringInfo(buf, "INSTEAD ");
|
appendStringInfo(buf, "INSTEAD ");
|
||||||
|
|
||||||
/* Finally the rules actions */
|
/* Finally the rules actions */
|
||||||
if (length(actions) > 1)
|
if (list_length(actions) > 1)
|
||||||
{
|
{
|
||||||
ListCell *action;
|
ListCell *action;
|
||||||
Query *query;
|
Query *query;
|
||||||
|
@ -1574,7 +1574,7 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||||
}
|
}
|
||||||
appendStringInfo(buf, ");");
|
appendStringInfo(buf, ");");
|
||||||
}
|
}
|
||||||
else if (length(actions) == 0)
|
else if (list_length(actions) == 0)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, "NOTHING;");
|
appendStringInfo(buf, "NOTHING;");
|
||||||
}
|
}
|
||||||
|
@ -1633,7 +1633,7 @@ make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||||
if (ev_action != NULL)
|
if (ev_action != NULL)
|
||||||
actions = (List *) stringToNode(ev_action);
|
actions = (List *) stringToNode(ev_action);
|
||||||
|
|
||||||
if (length(actions) != 1)
|
if (list_length(actions) != 1)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, "Not a view");
|
appendStringInfo(buf, "Not a view");
|
||||||
return;
|
return;
|
||||||
|
@ -1675,7 +1675,7 @@ get_query_def(Query *query, StringInfo buf, List *parentnamespace,
|
||||||
context.buf = buf;
|
context.buf = buf;
|
||||||
context.namespaces = lcons(&dpns, list_copy(parentnamespace));
|
context.namespaces = lcons(&dpns, list_copy(parentnamespace));
|
||||||
context.varprefix = (parentnamespace != NIL ||
|
context.varprefix = (parentnamespace != NIL ||
|
||||||
length(query->rtable) != 1);
|
list_length(query->rtable) != 1);
|
||||||
context.prettyFlags = prettyFlags;
|
context.prettyFlags = prettyFlags;
|
||||||
context.indentLevel = startIndent;
|
context.indentLevel = startIndent;
|
||||||
|
|
||||||
|
@ -2284,7 +2284,7 @@ get_names_for_var(Var *var, deparse_context *context,
|
||||||
var->varlevelsup);
|
var->varlevelsup);
|
||||||
|
|
||||||
/* Find the relevant RTE */
|
/* 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);
|
rte = rt_fetch(var->varno, dpns->rtable);
|
||||||
else if (var->varno == dpns->outer_varno)
|
else if (var->varno == dpns->outer_varno)
|
||||||
rte = dpns->outer_rte;
|
rte = dpns->outer_rte;
|
||||||
|
@ -2393,7 +2393,7 @@ get_simple_binary_op_name(OpExpr *expr)
|
||||||
{
|
{
|
||||||
List *args = expr->args;
|
List *args = expr->args;
|
||||||
|
|
||||||
if (length(args) == 2)
|
if (list_length(args) == 2)
|
||||||
{
|
{
|
||||||
/* binary operator */
|
/* binary operator */
|
||||||
Node *arg1 = (Node *) linitial(args);
|
Node *arg1 = (Node *) linitial(args);
|
||||||
|
@ -3063,7 +3063,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||||
char *sep;
|
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.
|
* but for simplicity we always print it.
|
||||||
*/
|
*/
|
||||||
appendStringInfo(buf, "ROW(");
|
appendStringInfo(buf, "ROW(");
|
||||||
|
@ -3240,7 +3240,7 @@ get_oper_expr(OpExpr *expr, deparse_context *context)
|
||||||
|
|
||||||
if (!PRETTY_PAREN(context))
|
if (!PRETTY_PAREN(context))
|
||||||
appendStringInfoChar(buf, '(');
|
appendStringInfoChar(buf, '(');
|
||||||
if (length(args) == 2)
|
if (list_length(args) == 2)
|
||||||
{
|
{
|
||||||
/* binary operator */
|
/* binary operator */
|
||||||
Node *arg1 = (Node *) linitial(args);
|
Node *arg1 = (Node *) linitial(args);
|
||||||
|
@ -3595,7 +3595,7 @@ get_sublink_expr(SubLink *sublink, deparse_context *context)
|
||||||
|
|
||||||
if (sublink->lefthand != NIL)
|
if (sublink->lefthand != NIL)
|
||||||
{
|
{
|
||||||
need_paren = (length(sublink->lefthand) > 1);
|
need_paren = (list_length(sublink->lefthand) > 1);
|
||||||
if (need_paren)
|
if (need_paren)
|
||||||
appendStringInfoChar(buf, '(');
|
appendStringInfoChar(buf, '(');
|
||||||
|
|
||||||
|
@ -3628,7 +3628,7 @@ get_sublink_expr(SubLink *sublink, deparse_context *context)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ANY_SUBLINK:
|
case ANY_SUBLINK:
|
||||||
if (length(sublink->operName) == 1 &&
|
if (list_length(sublink->operName) == 1 &&
|
||||||
strcmp(strVal(linitial(sublink->operName)), "=") == 0)
|
strcmp(strVal(linitial(sublink->operName)), "=") == 0)
|
||||||
{
|
{
|
||||||
/* Represent = ANY as IN */
|
/* 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
|
* resolve the correct function given the unqualified func name with
|
||||||
* the specified argtypes.
|
* the specified argtypes.
|
||||||
*/
|
*/
|
||||||
p_result = func_get_detail(makeList1(makeString(proname)),
|
p_result = func_get_detail(list_make1(makeString(proname)),
|
||||||
NIL, nargs, argtypes,
|
NIL, nargs, argtypes,
|
||||||
&p_funcid, &p_rettype,
|
&p_funcid, &p_rettype,
|
||||||
&p_retset, &p_true_typeids);
|
&p_retset, &p_true_typeids);
|
||||||
|
@ -4300,13 +4300,13 @@ generate_operator_name(Oid operid, Oid arg1, Oid arg2)
|
||||||
switch (operform->oprkind)
|
switch (operform->oprkind)
|
||||||
{
|
{
|
||||||
case 'b':
|
case 'b':
|
||||||
p_result = oper(makeList1(makeString(oprname)), arg1, arg2, true);
|
p_result = oper(list_make1(makeString(oprname)), arg1, arg2, true);
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
p_result = left_oper(makeList1(makeString(oprname)), arg2, true);
|
p_result = left_oper(list_make1(makeString(oprname)), arg2, true);
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
p_result = right_oper(makeList1(makeString(oprname)), arg1, true);
|
p_result = right_oper(list_make1(makeString(oprname)), arg1, true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "unrecognized oprkind: %d", operform->oprkind);
|
elog(ERROR, "unrecognized oprkind: %d", operform->oprkind);
|
||||||
|
@ -4342,7 +4342,7 @@ static void
|
||||||
print_operator_name(StringInfo buf, List *opname)
|
print_operator_name(StringInfo buf, List *opname)
|
||||||
{
|
{
|
||||||
ListCell *op = list_head(opname);
|
ListCell *op = list_head(opname);
|
||||||
int nnames = length(opname);
|
int nnames = list_length(opname);
|
||||||
|
|
||||||
if (nnames == 1)
|
if (nnames == 1)
|
||||||
appendStringInfoString(buf, strVal(lfirst(op)));
|
appendStringInfoString(buf, strVal(lfirst(op)));
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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)
|
if (eqopr == InvalidOid)
|
||||||
elog(ERROR, "no = operator for opclass %u", opclass);
|
elog(ERROR, "no = operator for opclass %u", opclass);
|
||||||
eqargs = makeList2(vardata.var, prefix);
|
eqargs = list_make2(vardata.var, prefix);
|
||||||
result = DatumGetFloat8(DirectFunctionCall4(eqsel,
|
result = DatumGetFloat8(DirectFunctionCall4(eqsel,
|
||||||
PointerGetDatum(root),
|
PointerGetDatum(root),
|
||||||
ObjectIdGetDatum(eqopr),
|
ObjectIdGetDatum(eqopr),
|
||||||
|
@ -1966,15 +1966,15 @@ estimate_num_groups(Query *root, List *groupExprs, double input_rows)
|
||||||
return input_rows;
|
return input_rows;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
allvars = nconc(allvars, varshere);
|
allvars = list_concat(allvars, varshere);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If now no Vars, we must have an all-constant GROUP BY list. */
|
/* If now no Vars, we must have an all-constant GROUP BY list. */
|
||||||
if (allvars == NIL)
|
if (allvars == NIL)
|
||||||
return 1.0;
|
return 1.0;
|
||||||
|
|
||||||
/* Use set_union() to discard duplicates */
|
/* Use list_union() to discard duplicates */
|
||||||
allvars = set_union(NIL, allvars);
|
allvars = list_union(NIL, allvars);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Step 2: acquire statistical estimate of number of distinct values
|
* 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);
|
ndistinct = get_variable_numdistinct(&vardata);
|
||||||
ReleaseVariableStats(vardata);
|
ReleaseVariableStats(vardata);
|
||||||
|
|
||||||
/* cannot use foreach here because of possible lremove */
|
/* cannot use foreach here because of possible list_delete */
|
||||||
l2 = list_head(varinfos);
|
l2 = list_head(varinfos);
|
||||||
while (l2)
|
while (l2)
|
||||||
{
|
{
|
||||||
MyVarInfo *varinfo = (MyVarInfo *) lfirst(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);
|
l2 = lnext(l2);
|
||||||
|
|
||||||
if (var->varno != varinfo->var->varno &&
|
if (var->varno != varinfo->var->varno &&
|
||||||
|
@ -2015,7 +2015,7 @@ estimate_num_groups(Query *root, List *groupExprs, double input_rows)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Delete the older item */
|
/* 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;
|
VariableStatData rdata;
|
||||||
|
|
||||||
/* Fail if not a binary opclause (probably shouldn't happen) */
|
/* Fail if not a binary opclause (probably shouldn't happen) */
|
||||||
if (length(args) != 2)
|
if (list_length(args) != 2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
left = (Node *) linitial(args);
|
left = (Node *) linitial(args);
|
||||||
|
@ -2892,7 +2892,7 @@ get_join_variables(Query *root, List *args,
|
||||||
Node *left,
|
Node *left,
|
||||||
*right;
|
*right;
|
||||||
|
|
||||||
if (length(args) != 2)
|
if (list_length(args) != 2)
|
||||||
elog(ERROR, "join operator should take two arguments");
|
elog(ERROR, "join operator should take two arguments");
|
||||||
|
|
||||||
left = (Node *) linitial(args);
|
left = (Node *) linitial(args);
|
||||||
|
@ -3654,7 +3654,7 @@ prefix_selectivity(Query *root, VariableStatData *vardata,
|
||||||
BTGreaterEqualStrategyNumber);
|
BTGreaterEqualStrategyNumber);
|
||||||
if (cmpopr == InvalidOid)
|
if (cmpopr == InvalidOid)
|
||||||
elog(ERROR, "no >= operator for opclass %u", opclass);
|
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 */
|
/* Assume scalargtsel is appropriate for all supported types */
|
||||||
prefixsel = DatumGetFloat8(DirectFunctionCall4(scalargtsel,
|
prefixsel = DatumGetFloat8(DirectFunctionCall4(scalargtsel,
|
||||||
PointerGetDatum(root),
|
PointerGetDatum(root),
|
||||||
|
@ -3676,7 +3676,7 @@ prefix_selectivity(Query *root, VariableStatData *vardata,
|
||||||
BTLessStrategyNumber);
|
BTLessStrategyNumber);
|
||||||
if (cmpopr == InvalidOid)
|
if (cmpopr == InvalidOid)
|
||||||
elog(ERROR, "no < operator for opclass %u", opclass);
|
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 */
|
/* Assume scalarltsel is appropriate for all supported types */
|
||||||
topsel = DatumGetFloat8(DirectFunctionCall4(scalarltsel,
|
topsel = DatumGetFloat8(DirectFunctionCall4(scalarltsel,
|
||||||
PointerGetDatum(root),
|
PointerGetDatum(root),
|
||||||
|
@ -4177,7 +4177,7 @@ genericcostestimate(Query *root, RelOptInfo *rel,
|
||||||
* eliminating duplicates is a bit trickier because indexQuals contains
|
* eliminating duplicates is a bit trickier because indexQuals contains
|
||||||
* RestrictInfo nodes and the indpred does not. It is okay to pass a
|
* 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
|
* 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
|
* indpred and strippedQuals, but then we'd not get caching of per-qual
|
||||||
* selectivity estimates.)
|
* selectivity estimates.)
|
||||||
*/
|
*/
|
||||||
|
@ -4187,8 +4187,8 @@ genericcostestimate(Query *root, RelOptInfo *rel,
|
||||||
List *predExtraQuals;
|
List *predExtraQuals;
|
||||||
|
|
||||||
strippedQuals = get_actual_clauses(indexQuals);
|
strippedQuals = get_actual_clauses(indexQuals);
|
||||||
predExtraQuals = set_difference(index->indpred, strippedQuals);
|
predExtraQuals = list_difference(index->indpred, strippedQuals);
|
||||||
selectivityQuals = nconc(predExtraQuals, indexQuals);
|
selectivityQuals = list_concat(predExtraQuals, indexQuals);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
selectivityQuals = indexQuals;
|
selectivityQuals = indexQuals;
|
||||||
|
@ -4253,7 +4253,7 @@ genericcostestimate(Query *root, RelOptInfo *rel,
|
||||||
* inaccuracies here ...
|
* inaccuracies here ...
|
||||||
*/
|
*/
|
||||||
cost_qual_eval(&index_qual_cost, indexQuals);
|
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 +
|
qual_arg_cost = index_qual_cost.startup +
|
||||||
index_qual_cost.per_tuple - qual_op_cost;
|
index_qual_cost.per_tuple - qual_op_cost;
|
||||||
if (qual_arg_cost < 0) /* just in case... */
|
if (qual_arg_cost < 0) /* just in case... */
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* NOTES
|
||||||
* input routine largely stolen from boxin().
|
* input routine largely stolen from boxin().
|
||||||
|
@ -239,7 +239,7 @@ currtid_for_view(Relation viewrel, ItemPointer tid)
|
||||||
Query *query;
|
Query *query;
|
||||||
TargetEntry *tle;
|
TargetEntry *tle;
|
||||||
|
|
||||||
if (length(rewrite->actions) != 1)
|
if (list_length(rewrite->actions) != 1)
|
||||||
elog(ERROR, "only one select rule is allowed in views");
|
elog(ERROR, "only one select rule is allowed in views");
|
||||||
query = (Query *) linitial(rewrite->actions);
|
query = (Query *) linitial(rewrite->actions);
|
||||||
tle = get_tle_by_resno(query->targetList, tididx+1);
|
tle = get_tle_by_resno(query->targetList, tididx+1);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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);
|
pfree(rawname);
|
||||||
freeList(namelist);
|
list_free(namelist);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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);
|
pfree(relation->rd_am);
|
||||||
if (relation->rd_rel)
|
if (relation->rd_rel)
|
||||||
pfree(relation->rd_rel);
|
pfree(relation->rd_rel);
|
||||||
freeList(relation->rd_indexlist);
|
list_free(relation->rd_indexlist);
|
||||||
if (relation->rd_indexcxt)
|
if (relation->rd_indexcxt)
|
||||||
MemoryContextDelete(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
|
* Now zap any remaining smgr cache entries. This must happen before
|
||||||
|
@ -1937,7 +1937,7 @@ RelationCacheInvalidate(void)
|
||||||
relation = (Relation) lfirst(l);
|
relation = (Relation) lfirst(l);
|
||||||
RelationClearRelation(relation, true);
|
RelationClearRelation(relation, true);
|
||||||
}
|
}
|
||||||
freeList(rebuildList);
|
list_free(rebuildList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2024,7 +2024,7 @@ AtEOXact_RelationCache(bool commit)
|
||||||
*/
|
*/
|
||||||
if (relation->rd_indexvalid == 2)
|
if (relation->rd_indexvalid == 2)
|
||||||
{
|
{
|
||||||
freeList(relation->rd_indexlist);
|
list_free(relation->rd_indexlist);
|
||||||
relation->rd_indexlist = NIL;
|
relation->rd_indexlist = NIL;
|
||||||
relation->rd_indexvalid = 0;
|
relation->rd_indexvalid = 0;
|
||||||
}
|
}
|
||||||
|
@ -2526,7 +2526,7 @@ RelationGetIndexList(Relation relation)
|
||||||
|
|
||||||
/* Quick exit if we already computed the list. */
|
/* Quick exit if we already computed the list. */
|
||||||
if (relation->rd_indexvalid != 0)
|
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)
|
* 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. */
|
/* Now save a copy of the completed list in the relcache entry. */
|
||||||
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
|
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
|
||||||
relation->rd_indexlist = listCopy(result);
|
relation->rd_indexlist = list_copy(result);
|
||||||
relation->rd_indexvalid = 1;
|
relation->rd_indexvalid = 1;
|
||||||
MemoryContextSwitchTo(oldcxt);
|
MemoryContextSwitchTo(oldcxt);
|
||||||
|
|
||||||
|
@ -2619,10 +2619,10 @@ RelationSetIndexList(Relation relation, List *indexIds)
|
||||||
Assert(relation->rd_isnailed == 1);
|
Assert(relation->rd_isnailed == 1);
|
||||||
/* Copy the list into the cache context (could fail for lack of mem) */
|
/* Copy the list into the cache context (could fail for lack of mem) */
|
||||||
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
|
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
|
||||||
indexIds = listCopy(indexIds);
|
indexIds = list_copy(indexIds);
|
||||||
MemoryContextSwitchTo(oldcxt);
|
MemoryContextSwitchTo(oldcxt);
|
||||||
/* Okay to replace old list */
|
/* Okay to replace old list */
|
||||||
freeList(relation->rd_indexlist);
|
list_free(relation->rd_indexlist);
|
||||||
relation->rd_indexlist = indexIds;
|
relation->rd_indexlist = indexIds;
|
||||||
relation->rd_indexvalid = 2; /* mark list as forced */
|
relation->rd_indexvalid = 2; /* mark list as forced */
|
||||||
}
|
}
|
||||||
|
@ -3083,7 +3083,7 @@ load_relcache_init_file(void)
|
||||||
{
|
{
|
||||||
RelationCacheInsert(rels[relno]);
|
RelationCacheInsert(rels[relno]);
|
||||||
/* also make a list of their OIDs, for RelationIdIsInInitFile */
|
/* also make a list of their OIDs, for RelationIdIsInInitFile */
|
||||||
initFileRelationIds = lconso(RelationGetRelid(rels[relno]),
|
initFileRelationIds = lcons_oid(RelationGetRelid(rels[relno]),
|
||||||
initFileRelationIds);
|
initFileRelationIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3242,7 +3242,7 @@ write_relcache_init_file(void)
|
||||||
|
|
||||||
/* also make a list of their OIDs, for RelationIdIsInInitFile */
|
/* also make a list of their OIDs, for RelationIdIsInInitFile */
|
||||||
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
|
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
|
||||||
initFileRelationIds = lconso(RelationGetRelid(rel),
|
initFileRelationIds = lcons_oid(RelationGetRelid(rel),
|
||||||
initFileRelationIds);
|
initFileRelationIds);
|
||||||
MemoryContextSwitchTo(oldcxt);
|
MemoryContextSwitchTo(oldcxt);
|
||||||
}
|
}
|
||||||
|
@ -3299,7 +3299,7 @@ write_relcache_init_file(void)
|
||||||
bool
|
bool
|
||||||
RelationIdIsInInitFile(Oid relationId)
|
RelationIdIsInInitFile(Oid relationId)
|
||||||
{
|
{
|
||||||
return oidMember(relationId, initFileRelationIds);
|
return list_member_oid(initFileRelationIds, relationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
else
|
||||||
return InvalidOid;
|
return InvalidOid;
|
||||||
|
|
||||||
if (argnum < 0 || argnum >= length(args))
|
if (argnum < 0 || argnum >= list_length(args))
|
||||||
return InvalidOid;
|
return InvalidOid;
|
||||||
|
|
||||||
argtype = exprType((Node *) nth(argnum, args));
|
argtype = exprType((Node *) list_nth(args, argnum));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* special hack for ScalarArrayOpExpr: what the underlying function
|
* special hack for ScalarArrayOpExpr: what the underlying function
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 */
|
/* syntax error in list */
|
||||||
pfree(rawstring);
|
pfree(rawstring);
|
||||||
freeList(elemlist);
|
list_free(elemlist);
|
||||||
ereport(LOG,
|
ereport(LOG,
|
||||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
errmsg("invalid list syntax for parameter \"preload_libraries\"")));
|
errmsg("invalid list syntax for parameter \"preload_libraries\"")));
|
||||||
|
@ -957,5 +957,5 @@ process_preload_libraries(char *preload_libraries_string)
|
||||||
}
|
}
|
||||||
|
|
||||||
pfree(rawstring);
|
pfree(rawstring);
|
||||||
freeList(elemlist);
|
list_free(elemlist);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 */
|
/* syntax error in list */
|
||||||
pfree(rawstring);
|
pfree(rawstring);
|
||||||
freeList(elemlist);
|
list_free(elemlist);
|
||||||
if (source >= PGC_S_INTERACTIVE)
|
if (source >= PGC_S_INTERACTIVE)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
(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\"",
|
errmsg("unrecognised \"log_destination\" key word: \"%s\"",
|
||||||
tok)));
|
tok)));
|
||||||
pfree(rawstring);
|
pfree(rawstring);
|
||||||
freeList(elemlist);
|
list_free(elemlist);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pfree(rawstring);
|
pfree(rawstring);
|
||||||
freeList(elemlist);
|
list_free(elemlist);
|
||||||
|
|
||||||
/* If we aren't going to do the assignment, just return OK indicator. */
|
/* If we aren't going to do the assignment, just return OK indicator. */
|
||||||
if (!doit)
|
if (!doit)
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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));
|
AssertArg(PortalIsValid(portal));
|
||||||
AssertState(portal->queryContext == NULL); /* else defined already */
|
AssertState(portal->queryContext == NULL); /* else defined already */
|
||||||
|
|
||||||
Assert(length(parseTrees) == length(planTrees));
|
Assert(list_length(parseTrees) == list_length(planTrees));
|
||||||
|
|
||||||
Assert(commandTag != NULL || parseTrees == NIL);
|
Assert(commandTag != NULL || parseTrees == NIL);
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -16,15 +16,6 @@
|
||||||
|
|
||||||
#include "nodes/nodes.h"
|
#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
|
* This package implements singly-linked homogeneous lists. It is
|
||||||
* important to have constant-time length, append, and prepend
|
* important to have constant-time length, append, and prepend
|
||||||
|
@ -50,15 +41,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct ListCell ListCell;
|
typedef struct ListCell ListCell;
|
||||||
typedef struct List List;
|
|
||||||
|
|
||||||
struct List
|
typedef struct List
|
||||||
{
|
{
|
||||||
NodeTag type; /* T_List, T_IntList, or T_OidList */
|
NodeTag type; /* T_List, T_IntList, or T_OidList */
|
||||||
int length;
|
int length;
|
||||||
ListCell *head;
|
ListCell *head;
|
||||||
ListCell *tail;
|
ListCell *tail;
|
||||||
};
|
} List;
|
||||||
|
|
||||||
struct ListCell
|
struct ListCell
|
||||||
{
|
{
|
||||||
|
@ -132,6 +122,10 @@ extern int list_length(List *l);
|
||||||
#define linitial_int(l) lfirst_int(list_head(l))
|
#define linitial_int(l) lfirst_int(list_head(l))
|
||||||
#define linitial_oid(l) lfirst_oid(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(l) lfirst(lnext(list_head(l)))
|
||||||
#define lsecond_int(l) lfirst_int(lnext(list_head(l)))
|
#define lsecond_int(l) lfirst_int(lnext(list_head(l)))
|
||||||
#define lsecond_oid(l) lfirst_oid(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
|
* simultaneously. This macro loops through both lists at the same
|
||||||
* time, stopping when either list runs out of elements. Depending
|
* time, stopping when either list runs out of elements. Depending
|
||||||
* on the requirements of the call site, it may also be wise to
|
* 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) \
|
#define forboth(cell1, list1, cell2, list2) \
|
||||||
for ((cell1) = list_head(list1), (cell2) = list_head(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 lfirsti(lc) lfirst_int(lc)
|
||||||
#define lfirsto(lc) lfirst_oid(lc)
|
#define lfirsto(lc) lfirst_oid(lc)
|
||||||
|
|
||||||
#define llast(l) lfirst(list_tail(l))
|
|
||||||
|
|
||||||
#define makeList1(x1) list_make1(x1)
|
#define makeList1(x1) list_make1(x1)
|
||||||
#define makeList2(x1, x2) list_make2(x1, x2)
|
#define makeList2(x1, x2) list_make2(x1, x2)
|
||||||
#define makeList3(x1, x2, x3) list_make3(x1, x2, x3)
|
#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);
|
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
|
typedef struct FastList
|
||||||
{
|
{
|
||||||
List *list;
|
List *list;
|
||||||
} FastList;
|
} FastList;
|
||||||
|
|
||||||
#ifdef ENABLE_LIST_COMPAT
|
|
||||||
|
|
||||||
extern void FastListInit(FastList *fl);
|
extern void FastListInit(FastList *fl);
|
||||||
extern void FastListFromList(FastList *fl, List *list);
|
extern void FastListFromList(FastList *fl, List *list);
|
||||||
extern List *FastListValue(FastList *fl);
|
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 FastConc(FastList *fl, List *cells);
|
||||||
extern void FastConcFast(FastList *fl1, FastList *fl2);
|
extern void FastConcFast(FastList *fl1, FastList *fl2);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* PG_LIST_H */
|
#endif /* PG_LIST_H */
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* 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
|
* transforms INSERT/UPDATE tlists into a normalized form with exactly
|
||||||
* one entry for each column of the destination table. Before that's
|
* one entry for each column of the destination table. Before that's
|
||||||
* happened, however, it is risky to assume that resno == position.
|
* happened, however, it is risky to assume that resno == position.
|
||||||
* Generally get_tle_by_resno() should be used rather than nth() to fetch
|
* Generally get_tle_by_resno() should be used rather than list_nth()
|
||||||
* tlist entries by resno.
|
* to fetch tlist entries by resno.
|
||||||
*
|
*
|
||||||
* resname is required to represent the correct column name in non-resjunk
|
* 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
|
* entries of top-level SELECT targetlists, since it will be used as the
|
||||||
|
|
|
@ -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 */
|
/* Copyright comment */
|
||||||
%{
|
%{
|
||||||
|
@ -4093,7 +4093,7 @@ file_name: StringConst { $$ = $1; };
|
||||||
/* func_name will soon return a List ... but not yet */
|
/* func_name will soon return a List ... but not yet */
|
||||||
/*
|
/*
|
||||||
func_name: function_name
|
func_name: function_name
|
||||||
{ $$ = makeList1(makeString($1)); }
|
{ $$ = list_make1(makeString($1)); }
|
||||||
| dotted_name
|
| dotted_name
|
||||||
{ $$ = $1; }
|
{ $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* procedural language
|
* procedural language
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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.
|
* 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
|
* 1. We can only evaluate queries that resulted in one single
|
||||||
* execution plan
|
* execution plan
|
||||||
*/
|
*/
|
||||||
if (length(spi_plan->ptlist) != 1)
|
if (list_length(spi_plan->ptlist) != 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
plan = (Plan *) linitial(spi_plan->ptlist);
|
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
|
* 4. The plan must have a single attribute as result
|
||||||
*/
|
*/
|
||||||
if (length(plan->targetlist) != 1)
|
if (list_length(plan->targetlist) != 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tle = (TargetEntry *) linitial(plan->targetlist);
|
tle = (TargetEntry *) linitial(plan->targetlist);
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* ENHANCEMENTS, OR MODIFICATIONS.
|
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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;
|
qdesc->argtypelems[i] = ((Form_pg_type) GETSTRUCT(typeTup))->typelem;
|
||||||
ReleaseSysCache(typeTup);
|
ReleaseSysCache(typeTup);
|
||||||
|
|
||||||
freeList(typename->names);
|
list_free(typename->names);
|
||||||
pfree(typename);
|
pfree(typename);
|
||||||
freeList(names);
|
list_free(names);
|
||||||
pfree(argcopy);
|
pfree(argcopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue