mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
target list fixes.
This commit is contained in:
parent
1d00134be4
commit
7702d7aa4b
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.28 1998/07/19 05:49:14 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.29 1998/07/20 21:18:32 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -446,7 +446,7 @@ pg_checkretval(Oid rettype, QueryTreeList *queryTreeList)
|
|||||||
|
|
||||||
if (typeTypeRelid(typ) == InvalidOid)
|
if (typeTypeRelid(typ) == InvalidOid)
|
||||||
{
|
{
|
||||||
if (exec_tlist_length(tlist) > 1)
|
if (ExecTargetListLength(tlist) > 1)
|
||||||
elog(ERROR, "function declared to return %s returns multiple values in final retrieve", typeTypeName(typ));
|
elog(ERROR, "function declared to return %s returns multiple values in final retrieve", typeTypeName(typ));
|
||||||
|
|
||||||
resnode = (Resdom *) ((TargetEntry *) lfirst(tlist))->resdom;
|
resnode = (Resdom *) ((TargetEntry *) lfirst(tlist))->resdom;
|
||||||
@ -464,7 +464,7 @@ pg_checkretval(Oid rettype, QueryTreeList *queryTreeList)
|
|||||||
* is 'retrieve (x = func2())', where func2 has the same return type
|
* is 'retrieve (x = func2())', where func2 has the same return type
|
||||||
* as the function that's calling it.
|
* as the function that's calling it.
|
||||||
*/
|
*/
|
||||||
if (exec_tlist_length(tlist) == 1)
|
if (ExecTargetListLength(tlist) == 1)
|
||||||
{
|
{
|
||||||
resnode = (Resdom *) ((TargetEntry *) lfirst(tlist))->resdom;
|
resnode = (Resdom *) ((TargetEntry *) lfirst(tlist))->resdom;
|
||||||
if (resnode->restype == rettype)
|
if (resnode->restype == rettype)
|
||||||
@ -485,7 +485,7 @@ pg_checkretval(Oid rettype, QueryTreeList *queryTreeList)
|
|||||||
relid = reln->rd_id;
|
relid = reln->rd_id;
|
||||||
relnatts = reln->rd_rel->relnatts;
|
relnatts = reln->rd_rel->relnatts;
|
||||||
|
|
||||||
if (exec_tlist_length(tlist) != relnatts)
|
if (ExecTargetListLength(tlist) != relnatts)
|
||||||
elog(ERROR, "function declared to return type %s does not retrieve (%s.*)", typeTypeName(typ), typeTypeName(typ));
|
elog(ERROR, "function declared to return type %s does not retrieve (%s.*)", typeTypeName(typ), typeTypeName(typ));
|
||||||
|
|
||||||
/* expect attributes 1 .. n in order */
|
/* expect attributes 1 .. n in order */
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.15 1998/07/20 19:53:48 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.16 1998/07/20 21:18:34 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -589,23 +589,3 @@ AddGroupAttrToTlist(List *tlist, List *grpCl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* was ExecTargetListLength() in execQual.c,
|
|
||||||
moved here to reduce dependencies on the executor module */
|
|
||||||
int
|
|
||||||
exec_tlist_length(List *targetlist)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
List *tl;
|
|
||||||
TargetEntry *curTle;
|
|
||||||
|
|
||||||
len = 0;
|
|
||||||
foreach(tl, targetlist)
|
|
||||||
{
|
|
||||||
curTle = lfirst(tl);
|
|
||||||
|
|
||||||
if (curTle->resdom != NULL)
|
|
||||||
len++;
|
|
||||||
}
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: tlist.h,v 1.11 1998/07/20 20:48:54 momjian Exp $
|
* $Id: tlist.h,v 1.12 1998/07/20 21:18:35 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -17,7 +17,6 @@
|
|||||||
#include "nodes/parsenodes.h"
|
#include "nodes/parsenodes.h"
|
||||||
#include "nodes/relation.h"
|
#include "nodes/relation.h"
|
||||||
|
|
||||||
extern int exec_tlist_length(List *targelist);
|
|
||||||
extern TargetEntry *tlistentry_member(Var *var, List *targetlist);
|
extern TargetEntry *tlistentry_member(Var *var, List *targetlist);
|
||||||
extern Expr *matching_tlvar(Var *var, List *targetlist);
|
extern Expr *matching_tlvar(Var *var, List *targetlist);
|
||||||
extern void add_tl_element(RelOptInfo *rel, Var *var);
|
extern void add_tl_element(RelOptInfo *rel, Var *var);
|
||||||
@ -30,8 +29,7 @@ extern TargetEntry *match_varid(Var *test_var, List *tlist);
|
|||||||
extern List *new_unsorted_tlist(List *targetlist);
|
extern List *new_unsorted_tlist(List *targetlist);
|
||||||
extern List *copy_vars(List *target, List *source);
|
extern List *copy_vars(List *target, List *source);
|
||||||
extern List *flatten_tlist(List *tlist);
|
extern List *flatten_tlist(List *tlist);
|
||||||
extern List *
|
extern List *flatten_tlist_vars(List *full_tlist,
|
||||||
flatten_tlist_vars(List *full_tlist,
|
|
||||||
List *flat_tlist);
|
List *flat_tlist);
|
||||||
|
|
||||||
#endif /* TLIST_H */
|
#endif /* TLIST_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user