Commit 74c14995 authored by Tom Lane's avatar Tom Lane

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

or return type.
parent 2a7a75ee
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* procedural language * procedural language
* *
* IDENTIFICATION * 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. * This software is copyrighted by Jan Wieck - Hamburg.
* *
...@@ -181,6 +181,10 @@ plpgsql_compile(Oid fn_oid, int functype) ...@@ -181,6 +181,10 @@ plpgsql_compile(Oid fn_oid, int functype)
if (!HeapTupleIsValid(typeTup)) if (!HeapTupleIsValid(typeTup))
{ {
plpgsql_comperrinfo(); plpgsql_comperrinfo();
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", elog(ERROR, "cache lookup for return type %u failed",
procStruct->prorettype); procStruct->prorettype);
} }
...@@ -214,6 +218,9 @@ plpgsql_compile(Oid fn_oid, int functype) ...@@ -214,6 +218,9 @@ plpgsql_compile(Oid fn_oid, int functype)
if (!HeapTupleIsValid(typeTup)) if (!HeapTupleIsValid(typeTup))
{ {
plpgsql_comperrinfo(); plpgsql_comperrinfo();
if (!OidIsValid(procStruct->proargtypes[i]))
elog(ERROR, "plpgsql functions cannot take type \"opaque\"");
else
elog(ERROR, "cache lookup for argument type %u failed", elog(ERROR, "cache lookup for argument type %u failed",
procStruct->proargtypes[i]); procStruct->proargtypes[i]);
} }
...@@ -232,7 +239,8 @@ plpgsql_compile(Oid fn_oid, int functype) ...@@ -232,7 +239,8 @@ plpgsql_compile(Oid fn_oid, int functype)
if (plpgsql_parse_wordrowtype(buf) != T_ROW) if (plpgsql_parse_wordrowtype(buf) != T_ROW)
{ {
plpgsql_comperrinfo(); 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; row = plpgsql_yylval.row;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment