|
33 | 33 | * ENHANCEMENTS, OR MODIFICATIONS. |
34 | 34 | * |
35 | 35 | * IDENTIFICATION |
36 | | - * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.60 2004/11/2121:17:03 tgl Exp $ |
| 36 | + * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.61 2004/11/2122:13:37 tgl Exp $ |
37 | 37 | * |
38 | 38 | **********************************************************************/ |
39 | 39 |
|
@@ -963,9 +963,25 @@ plperl_func_handler(PG_FUNCTION_ARGS) |
963 | 963 |
|
964 | 964 | if (prodesc->fn_retistuple&&fcinfo->resultinfo)/* set of tuples */ |
965 | 965 | { |
| 966 | +/* |
| 967 | + * This branch will be taken when the function call |
| 968 | + * appears in a context that can return a set of tuples, |
| 969 | + * even if it only actually returns a single tuple |
| 970 | + * (e.g. select a from foo() where foo returns a singleton |
| 971 | + * of some composite type with member a). In this case, the |
| 972 | + * return value will be a hashref. If a rowset is returned |
| 973 | + * it will be an arrayref whose members will be hashrefs. |
| 974 | + * |
| 975 | + * Care is taken in the code only to refer to the appropriate |
| 976 | + * one of ret_hv and ret_av, only one of which is therefore |
| 977 | + * valid for any given call. |
| 978 | + * |
| 979 | + * XXX This code is in dire need of cleanup. |
| 980 | + */ |
| 981 | + |
966 | 982 | /* SRF support */ |
967 | | -HV*ret_hv; |
968 | | -AV*ret_av; |
| 983 | +HV*ret_hv=NULL; |
| 984 | +AV*ret_av=NULL; |
969 | 985 | FuncCallContext*funcctx; |
970 | 986 | intcall_cntr; |
971 | 987 | intmax_calls; |
|