1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +03:00

Move pg_checkretval out of the planner (where it never belonged) into

pg_proc.c (where it's actually used).  Fix it to correctly handle tlists
that contain resjunk target items, and improve error messages.  This
addresses bug reported by Krupnikov 6-July-00.
This commit is contained in:
Tom Lane
2000-08-21 20:55:31 +00:00
parent 469673f966
commit 7893462e44
5 changed files with 164 additions and 149 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.77 2000/08/08 15:41:22 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.78 2000/08/21 20:55:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1444,17 +1444,18 @@ ExecQual(List *qual, ExprContext *econtext, bool resultForNull)
return result;
}
/*
* Number of items in a tlist (including any resjunk items!)
*/
int
ExecTargetListLength(List *targetlist)
{
int len;
int len = 0;
List *tl;
TargetEntry *curTle;
len = 0;
foreach(tl, targetlist)
{
curTle = lfirst(tl);
TargetEntry *curTle = (TargetEntry *) lfirst(tl);
if (curTle->resdom != NULL)
len++;
@ -1464,6 +1465,32 @@ ExecTargetListLength(List *targetlist)
return len;
}
/*
* Number of items in a tlist, not including any resjunk items
*/
int
ExecCleanTargetListLength(List *targetlist)
{
int len = 0;
List *tl;
foreach(tl, targetlist)
{
TargetEntry *curTle = (TargetEntry *) lfirst(tl);
if (curTle->resdom != NULL)
{
if (! curTle->resdom->resjunk)
len++;
}
else
{
len += curTle->fjoin->fj_nNodes;
}
}
return len;
}
/* ----------------------------------------------------------------
* ExecTargetList
*