Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit74c1499

Browse files
committed
Improve error message for erroneous use of 'opaque' as plpgsql argument
or return type.
1 parent2a7a75e commit74c1499

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

‎src/pl/plpgsql/src/pl_comp.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* procedural language
44
*
55
* IDENTIFICATION
6-
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.24 2000/11/16 22:30:50 tgl Exp $
6+
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.25 2000/12/08 00:03:02 tgl Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -181,8 +181,12 @@ plpgsql_compile(Oid fn_oid, int functype)
181181
if (!HeapTupleIsValid(typeTup))
182182
{
183183
plpgsql_comperrinfo();
184-
elog(ERROR,"cache lookup for return type %u failed",
185-
procStruct->prorettype);
184+
if (!OidIsValid(procStruct->prorettype))
185+
elog(ERROR,"plpgsql functions cannot return type \"opaque\""
186+
"\n\texcept when used as triggers");
187+
else
188+
elog(ERROR,"cache lookup for return type %u failed",
189+
procStruct->prorettype);
186190
}
187191
typeStruct= (Form_pg_type)GETSTRUCT(typeTup);
188192
if (typeStruct->typrelid!=InvalidOid)
@@ -214,8 +218,11 @@ plpgsql_compile(Oid fn_oid, int functype)
214218
if (!HeapTupleIsValid(typeTup))
215219
{
216220
plpgsql_comperrinfo();
217-
elog(ERROR,"cache lookup for argument type %u failed",
218-
procStruct->proargtypes[i]);
221+
if (!OidIsValid(procStruct->proargtypes[i]))
222+
elog(ERROR,"plpgsql functions cannot take type \"opaque\"");
223+
else
224+
elog(ERROR,"cache lookup for argument type %u failed",
225+
procStruct->proargtypes[i]);
219226
}
220227
typeStruct= (Form_pg_type)GETSTRUCT(typeTup);
221228

@@ -232,7 +239,8 @@ plpgsql_compile(Oid fn_oid, int functype)
232239
if (plpgsql_parse_wordrowtype(buf)!=T_ROW)
233240
{
234241
plpgsql_comperrinfo();
235-
elog(ERROR,"cannot get tuple struct of argument %d",i+1);
242+
elog(ERROR,"cannot get tuple struct of argument %d",
243+
i+1);
236244
}
237245

238246
row=plpgsql_yylval.row;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp