提交 74c14995 编写于 作者: T Tom Lane

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

or return type.
上级 2a7a75ee
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册