diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-06-06 00:41:28 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-06-06 00:41:28 +0000 |
commit | c541bb86e9ec8fed37b23df6a0df703d0bde4dfa (patch) | |
tree | b4cff96eecc86e338274ec5d7355918efe9c149e /src/pl/plperl/plperl.c | |
parent | c3a153afed84e29dac664bdc6123724a9e3a906f (diff) | |
download | postgresql-c541bb86e9ec8fed37b23df6a0df703d0bde4dfa.tar.gz postgresql-c541bb86e9ec8fed37b23df6a0df703d0bde4dfa.zip |
Infrastructure for I/O of composite types: arrange for the I/O routines
of a composite type to get that type's OID as their second parameter,
in place of typelem which is useless. The actual changes are mostly
centralized in getTypeInputInfo and siblings, but I had to fix a few
places that were fetching pg_type.typelem for themselves instead of
using the lsyscache.c routines. Also, I renamed all the related variables
from 'typelem' to 'typioparam' to discourage people from assuming that
they necessarily contain array element types.
Diffstat (limited to 'src/pl/plperl/plperl.c')
-rw-r--r-- | src/pl/plperl/plperl.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index 8c3680ae19c..7bb2ac34331 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -33,7 +33,7 @@ * ENHANCEMENTS, OR MODIFICATIONS. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.43 2004/04/01 21:28:46 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.44 2004/06/06 00:41:28 tgl Exp $ * **********************************************************************/ @@ -79,10 +79,10 @@ typedef struct plperl_proc_desc CommandId fn_cmin; bool lanpltrusted; FmgrInfo result_in_func; - Oid result_in_elem; + Oid result_typioparam; int nargs; FmgrInfo arg_out_func[FUNC_MAX_ARGS]; - Oid arg_out_elem[FUNC_MAX_ARGS]; + Oid arg_typioparam[FUNC_MAX_ARGS]; bool arg_is_rowtype[FUNC_MAX_ARGS]; SV *reference; } plperl_proc_desc; @@ -428,7 +428,7 @@ plperl_call_perl_func(plperl_proc_desc * desc, FunctionCallInfo fcinfo) tmp = DatumGetCString(FunctionCall3(&(desc->arg_out_func[i]), fcinfo->arg[i], - ObjectIdGetDatum(desc->arg_out_elem[i]), + ObjectIdGetDatum(desc->arg_typioparam[i]), Int32GetDatum(-1))); XPUSHs(sv_2mortal(newSVpv(tmp, 0))); pfree(tmp); @@ -506,7 +506,7 @@ plperl_func_handler(PG_FUNCTION_ARGS) { retval = FunctionCall3(&prodesc->result_in_func, PointerGetDatum(SvPV(perlret, PL_na)), - ObjectIdGetDatum(prodesc->result_in_elem), + ObjectIdGetDatum(prodesc->result_typioparam), Int32GetDatum(-1)); } @@ -671,7 +671,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger) } perm_fmgr_info(typeStruct->typinput, &(prodesc->result_in_func)); - prodesc->result_in_elem = typeStruct->typelem; + prodesc->result_typioparam = getTypeIOParam(typeTup); ReleaseSysCache(typeTup); } @@ -715,7 +715,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger) prodesc->arg_is_rowtype[i] = false; perm_fmgr_info(typeStruct->typoutput, &(prodesc->arg_out_func[i])); - prodesc->arg_out_elem[i] = typeStruct->typelem; + prodesc->arg_typioparam[i] = getTypeIOParam(typeTup); } ReleaseSysCache(typeTup); @@ -776,7 +776,7 @@ plperl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc) char *outputstr; HeapTuple typeTup; Oid typoutput; - Oid typelem; + Oid typioparam; output = sv_2mortal(newSVpv("{", 0)); @@ -817,7 +817,7 @@ plperl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc) tupdesc->attrs[i]->atttypid); typoutput = ((Form_pg_type) GETSTRUCT(typeTup))->typoutput; - typelem = ((Form_pg_type) GETSTRUCT(typeTup))->typelem; + typioparam = getTypeIOParam(typeTup); ReleaseSysCache(typeTup); /************************************************************ @@ -825,7 +825,7 @@ plperl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc) ************************************************************/ outputstr = DatumGetCString(OidFunctionCall3(typoutput, attr, - ObjectIdGetDatum(typelem), + ObjectIdGetDatum(typioparam), Int32GetDatum(tupdesc->attrs[i]->atttypmod))); sv_catpvf(output, "'%s' => '%s',", attname, outputstr); pfree(outputstr); |