mirror of https://github.com/postgres/postgres
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.
This commit is contained in:
parent
1a0bbc296c
commit
4f38b9a80a
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.35 2008/06/19 00:46:04 alvherre Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.36 2008/11/14 17:40:56 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue