Bugs in parse_func.c ?

Поиск
Список
Период
Сортировка
Искать

Bugs in parse_func.c ?

От:
"Hiroshi Inoue" <Inoue@tpf.co.jp>
Дата:
Hi all

I found 2 BUGs ? caused by ParseComplexProject() function  in parse_func.c.

The result of the following cases are different from the design 
of ParseComplexProject() in parse_func.c ?

1. Projecting attributes of function return values never execute   right operations.   create table a (elem int4);  create function ax2(int4) returns a as  'select $1*2;'  language 'sql';  select elem(ax2(1));  the result is  elem  ----     4  (1 row)  It's wrong.  PostgreSQL executor evaluates functions twice.  After applying patch the result is the following  elem  ----     2  (1 row)
2.PostgreSQL parser rejects functions unnecessarily create function elemout(a) returns int4 as 'select $1.elem;' language 'sql'; select elemout(ax2(1)); ERROR:  Function 'elemout' has bad return type 315169
 This rejection by elog() is necessary ? I removed it and the result is elemout -------       2 (1 row)


I posted a patch for these cases (Subject:Projecting attributes 
of function return values)  a few days ago.
The same patch is at the end of this posting.

If   those cases are BUGs,please confirm my patch.

Thanks

Hiroshi Inoue
Inoue@tpf.co.jp

*** backend/parser/parse_func.c.orig	Thu Dec  3 18:25:31 1998
--- backend/parser/parse_func.c	Thu Dec  3 18:39:18 1998
***************
*** 1352,1358 **** 						newexpr->typeOid = funcnode->functype; 						newexpr->opType = FUNC_EXPR; 						newexpr->oper = (Node *) funcnode;
! 						newexpr->args = lcons(first_arg, NIL);  						return (Node *) newexpr; 					}
--- 1352,1358 ---- 						newexpr->typeOid = funcnode->functype; 						newexpr->opType = FUNC_EXPR; 						newexpr->oper = (Node *) funcnode;
! 						newexpr->args = expr->args;  						return (Node *) newexpr; 					}
***************
*** 1359,1366 ****  				} 
- 				elog(ERROR, "Function '%s' has bad return type %d",
- 					 funcname, argtype); 				break; 			} 		case T_Param:
--- 1359,1364 ----





FAQ