From: Tom Lane Date: Thu, 7 Dec 2000 19:40:56 +0000 (+0000) Subject: checkretval() failed to cope with an empty SQL function body. X-Git-Tag: REL9_0_0~21925 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=cbc5f4f127f37510fa000ddd8a109c8385796176;p=pg-rex%2Fsyncrep.git checkretval() failed to cope with an empty SQL function body. --- diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c index 5d63ebf161..1e594bfe25 100644 --- a/src/backend/catalog/pg_proc.c +++ b/src/backend/catalog/pg_proc.c @@ -8,7 +8,7 @@ * * * 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) int relnatts; 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 */ parse = (Query *) nth(length(queryTreeList) - 1, queryTreeList);