Improve error message for erroneous use of 'opaque' as plpgsql argument

or return type.
This commit is contained in:
Tom Lane 2000-12-08 00:03:02 +00:00
parent 2a7a75ee7e
commit 74c14995f1
1 changed files with 14 additions and 6 deletions

View File

@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.24 2000/11/16 22:30:50 tgl Exp $
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.25 2000/12/08 00:03:02 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@ -181,8 +181,12 @@ plpgsql_compile(Oid fn_oid, int functype)
if (!HeapTupleIsValid(typeTup))
{
plpgsql_comperrinfo();
elog(ERROR, "cache lookup for return type %u failed",
procStruct->prorettype);
if (!OidIsValid(procStruct->prorettype))
elog(ERROR, "plpgsql functions cannot return type \"opaque\""
"\n\texcept when used as triggers");
else
elog(ERROR, "cache lookup for return type %u failed",
procStruct->prorettype);
}
typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
if (typeStruct->typrelid != InvalidOid)
@ -214,8 +218,11 @@ plpgsql_compile(Oid fn_oid, int functype)
if (!HeapTupleIsValid(typeTup))
{
plpgsql_comperrinfo();
elog(ERROR, "cache lookup for argument type %u failed",
procStruct->proargtypes[i]);
if (!OidIsValid(procStruct->proargtypes[i]))
elog(ERROR, "plpgsql functions cannot take type \"opaque\"");
else
elog(ERROR, "cache lookup for argument type %u failed",
procStruct->proargtypes[i]);
}
typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
@ -232,7 +239,8 @@ plpgsql_compile(Oid fn_oid, int functype)
if (plpgsql_parse_wordrowtype(buf) != T_ROW)
{
plpgsql_comperrinfo();
elog(ERROR, "cannot get tuple struct of argument %d", i + 1);
elog(ERROR, "cannot get tuple struct of argument %d",
i + 1);
}
row = plpgsql_yylval.row;