Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4f38b9a

Browse files
committed
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.
1 parent 1a0bbc2 commit 4f38b9a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/backend/commands/conversioncmds.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.35 2008/06/19 00:46:04 alvherre Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.36 2008/11/14 17:40:56 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -82,6 +82,13 @@ CreateConversionCommand(CreateConversionStmt *stmt)
8282
funcoid = LookupFuncName(func_name, sizeof(funcargs) / sizeof(Oid),
8383
funcargs, false);
8484

85+
/* Check it returns VOID, else it's probably the wrong function */
86+
if (get_func_rettype(funcoid) != VOIDOID)
87+
ereport(ERROR,
88+
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
89+
errmsg("encoding conversion function %s must return type \"void\"",
90+
NameListToString(func_name))));
91+
8592
/* Check we have EXECUTE rights for the function */
8693
aclresult = pg_proc_aclcheck(funcoid, GetUserId(), ACL_EXECUTE);
8794
if (aclresult != ACLCHECK_OK)

0 commit comments

Comments
 (0)