From: Tom Lane Date: Fri, 14 Nov 2008 17:40:56 +0000 (+0000) Subject: Make CREATE CONVERSION verify that a putative encoding conversion function X-Git-Tag: recoveryinfrav9~345 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=fe568aed783bdb4d4a7e32bfd0ce255c9d6b581a;p=users%2Fsimon%2Fpostgres.git Make CREATE CONVERSION verify that a putative encoding conversion function returns VOID. This is the last of the easy fixes I recommended in 11870.1218838360@sss.pgh.pa.us --- the others got done awhile ago but I forgot about this one. --- diff --git a/src/backend/commands/conversioncmds.c b/src/backend/commands/conversioncmds.c index 2ab0759b4d..c26811ef45 100644 --- a/src/backend/commands/conversioncmds.c +++ b/src/backend/commands/conversioncmds.c @@ -82,6 +82,13 @@ CreateConversionCommand(CreateConversionStmt *stmt) funcoid = LookupFuncName(func_name, sizeof(funcargs) / sizeof(Oid), funcargs, false); + /* Check it returns VOID, else it's probably the wrong function */ + if (get_func_rettype(funcoid) != VOIDOID) + ereport(ERROR, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("encoding conversion function %s must return type \"void\"", + NameListToString(func_name)))); + /* Check we have EXECUTE rights for the function */ aclresult = pg_proc_aclcheck(funcoid, GetUserId(), ACL_EXECUTE); if (aclresult != ACLCHECK_OK)