提交 cbc5f4f1 编写于 作者: T Tom Lane

checkretval() failed to cope with an empty SQL function body.

上级 821f4673
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.51 2000/11/20 20:36:47 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.52 2000/12/07 19:40:56 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -339,6 +339,15 @@ checkretval(Oid rettype, List *queryTreeList) ...@@ -339,6 +339,15 @@ checkretval(Oid rettype, List *queryTreeList)
int relnatts; int relnatts;
int i; int i;
/* guard against empty function body; OK only if no return type */
if (queryTreeList == NIL)
{
if (rettype != InvalidOid)
elog(ERROR, "function declared to return %s, but no SELECT provided",
typeidTypeName(rettype));
return;
}
/* find the final query */ /* find the final query */
parse = (Query *) nth(length(queryTreeList) - 1, queryTreeList); parse = (Query *) nth(length(queryTreeList) - 1, queryTreeList);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册