Skip to content

Commit 6e646c7

Browse files
committed
Improve error message for erroneous use of 'opaque' as pltcl argument
or return type.
1 parent 74c1499 commit 6e646c7

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/pl/tcl/pltcl.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ENHANCEMENTS, OR MODIFICATIONS.
3232
*
3333
* IDENTIFICATION
34-
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.30 2000/11/20 20:36:52 tgl Exp $
34+
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.31 2000/12/08 00:09:07 tgl Exp $
3535
*
3636
**********************************************************************/
3737

@@ -489,8 +489,12 @@ pltcl_func_handler(PG_FUNCTION_ARGS)
489489
{
490490
free(prodesc->proname);
491491
free(prodesc);
492-
elog(ERROR, "pltcl: cache lookup for return type %u failed",
493-
procStruct->prorettype);
492+
if (!OidIsValid(procStruct->prorettype))
493+
elog(ERROR, "pltcl functions cannot return type \"opaque\""
494+
"\n\texcept when used as triggers");
495+
else
496+
elog(ERROR, "pltcl: cache lookup for return type %u failed",
497+
procStruct->prorettype);
494498
}
495499
typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
496500

@@ -521,8 +525,11 @@ pltcl_func_handler(PG_FUNCTION_ARGS)
521525
{
522526
free(prodesc->proname);
523527
free(prodesc);
524-
elog(ERROR, "pltcl: cache lookup for argument type %u failed",
525-
procStruct->proargtypes[i]);
528+
if (!OidIsValid(procStruct->proargtypes[i]))
529+
elog(ERROR, "pltcl functions cannot take type \"opaque\"");
530+
else
531+
elog(ERROR, "pltcl: cache lookup for argument type %u failed",
532+
procStruct->proargtypes[i]);
526533
}
527534
typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
528535

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