aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2005-08-12 20:48:03 +0000
committerBruce Momjian <bruce@momjian.us>2005-08-12 20:48:03 +0000
commit60672b59b8c32d1b12ca8cbe088649cbf44de258 (patch)
treed8599e77b864d49ba968055f722377b68278486f
parent88a2b5c10fb3626bda3a055423b5b3a5dc4fe45b (diff)
downloadpostgresql-60672b59b8c32d1b12ca8cbe088649cbf44de258.tar.gz
postgresql-60672b59b8c32d1b12ca8cbe088649cbf44de258.zip
> The attached patch moves a plperl sanity check into the correct
> position. Performing the check in the existing position allows the call > to go through to perl first, possibly resulting in a SEGV. Andrew Dunstan
-rw-r--r--src/pl/plperl/plperl.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 3e97fb87557..2d920c6908c 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.86 2005/07/12 20:35:42 tgl Exp $
+ * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.87 2005/08/12 20:48:03 momjian Exp $
*
**********************************************************************/
@@ -921,6 +921,16 @@ plperl_func_handler(PG_FUNCTION_ARGS)
plperl_current_tuple_store = 0;
plperl_current_tuple_desc = 0;
+ if (!rsi || !IsA(rsi, ReturnSetInfo) ||
+ (rsi->allowedModes & SFRM_Materialize) == 0 ||
+ rsi->expectedDesc == NULL)
+ {
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("set-valued function called in context that "
+ "cannot accept a set")));
+ }
+
perlret = plperl_call_perl_func(prodesc, fcinfo);
/************************************************************
@@ -936,16 +946,6 @@ plperl_func_handler(PG_FUNCTION_ARGS)
if (prodesc->fn_retisset)
{
- if (!rsi || !IsA(rsi, ReturnSetInfo) ||
- (rsi->allowedModes & SFRM_Materialize) == 0 ||
- rsi->expectedDesc == NULL)
- {
- ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("set-valued function called in context that "
- "cannot accept a set")));
- }
-
/* If the Perl function returned an arrayref, we pretend that it
* called return_next() for each element of the array, to handle
* old SRFs that didn't know about return_next(). Any other sort