]> granicus.if.org Git - postgresql/commitdiff
Allow generic record arguments to plperl functions
authorAndrew Dunstan <andrew@dunslane.net>
Fri, 29 Oct 2010 00:48:12 +0000 (20:48 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Fri, 29 Oct 2010 00:48:12 +0000 (20:48 -0400)
src/pl/plperl/plperl.c

index 6754d5ac72fc3ed3e9025a7eb258fa992a3d4552..44becda3f32c3065e4a24fe58cf899b033e1430c 100644 (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
                                {