From 32c97fd58ffdd5c7b62e9bc80d6311b608823218 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 21 Nov 2004 22:13:37 +0000 Subject: [PATCH] Suppress remaining compile warnings, and add a comment about why it's not really broken. Andrew Dunstan --- src/pl/plperl/SPI.xs | 4 ++++ src/pl/plperl/plperl.c | 22 +++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/pl/plperl/SPI.xs b/src/pl/plperl/SPI.xs index 1a23c0ca25..7e71e77ade 100644 --- a/src/pl/plperl/SPI.xs +++ b/src/pl/plperl/SPI.xs @@ -94,3 +94,7 @@ spi_spi_exec_query(query, ...) RETVAL = newRV_noinc((SV*) ret_hash); OUTPUT: RETVAL + + +BOOT: + items = 0; /* avoid 'unused variable' warning */ diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index 36665cff27..b2f4bf74a4 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.60 2004/11/21 21:17:03 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.61 2004/11/21 22:13:37 tgl Exp $ * **********************************************************************/ @@ -963,9 +963,25 @@ plperl_func_handler(PG_FUNCTION_ARGS) if (prodesc->fn_retistuple && fcinfo->resultinfo) /* set of tuples */ { + /* + * This branch will be taken when the function call + * appears in a context that can return a set of tuples, + * even if it only actually returns a single tuple + * (e.g. select a from foo() where foo returns a singleton + * of some composite type with member a). In this case, the + * return value will be a hashref. If a rowset is returned + * it will be an arrayref whose members will be hashrefs. + * + * Care is taken in the code only to refer to the appropriate + * one of ret_hv and ret_av, only one of which is therefore + * valid for any given call. + * + * XXX This code is in dire need of cleanup. + */ + /* SRF support */ - HV *ret_hv; - AV *ret_av; + HV *ret_hv = NULL; + AV *ret_av = NULL; FuncCallContext *funcctx; int call_cntr; int max_calls; -- 2.11.0