Skip to content

Commit cbc5f4f

Browse files
committed
checkretval() failed to cope with an empty SQL function body.
1 parent 821f467 commit cbc5f4f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/backend/catalog/pg_proc.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.51 2000/11/20 20:36:47 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.52 2000/12/07 19:40:56 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -339,6 +339,15 @@ checkretval(Oid rettype, List *queryTreeList)
339339
int relnatts;
340340
int i;
341341

342+
/* guard against empty function body; OK only if no return type */
343+
if (queryTreeList == NIL)
344+
{
345+
if (rettype != InvalidOid)
346+
elog(ERROR, "function declared to return %s, but no SELECT provided",
347+
typeidTypeName(rettype));
348+
return;
349+
}
350+
342351
/* find the final query */
343352
parse = (Query *) nth(length(queryTreeList) - 1, queryTreeList);
344353

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy