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

Lines changed: 8 additions & 1 deletion
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)
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