Allow generic record arguments to plperl functions

This commit is contained in:
Andrew Dunstan 2010-10-28 20:48:12 -04:00
parent a3d40e9fb5
commit 6c3c7b533e
1 changed files with 6 additions and 3 deletions

View File

@ -1371,7 +1371,8 @@ plperl_validator(PG_FUNCTION_ARGS)
&argtypes, &argnames, &argmodes);
for (i = 0; i < numargs; i++)
{
if (get_typtype(argtypes[i]) == TYPTYPE_PSEUDO)
if (get_typtype(argtypes[i]) == TYPTYPE_PSEUDO &&
argtypes[i] != RECORDOID)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("PL/Perl functions cannot accept type %s",
@ -2105,7 +2106,8 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
/* Disallow pseudotype argument */
if (typeStruct->typtype == TYPTYPE_PSEUDO)
if (typeStruct->typtype == TYPTYPE_PSEUDO &&
procStruct->proargtypes.values[i] != RECORDOID)
{
free(prodesc->proname);
free(prodesc);
@ -2115,7 +2117,8 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
format_type_be(procStruct->proargtypes.values[i]))));
}
if (typeStruct->typtype == TYPTYPE_COMPOSITE)
if (typeStruct->typtype == TYPTYPE_COMPOSITE ||
procStruct->proargtypes.values[i] == RECORDOID)
prodesc->arg_is_rowtype[i] = true;
else
{