Skip to content

Commit 60672b5

Browse files
committed
> 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
1 parent 88a2b5c commit 60672b5

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/pl/plperl/plperl.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* ENHANCEMENTS, OR MODIFICATIONS.
3434
*
3535
* IDENTIFICATION
36-
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.86 2005/07/12 20:35:42 tgl Exp $
36+
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.87 2005/08/12 20:48:03 momjian Exp $
3737
*
3838
**********************************************************************/
3939

@@ -921,6 +921,16 @@ plperl_func_handler(PG_FUNCTION_ARGS)
921921
plperl_current_tuple_store = 0;
922922
plperl_current_tuple_desc = 0;
923923

924+
if (!rsi || !IsA(rsi, ReturnSetInfo) ||
925+
(rsi->allowedModes & SFRM_Materialize) == 0 ||
926+
rsi->expectedDesc == NULL)
927+
{
928+
ereport(ERROR,
929+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
930+
errmsg("set-valued function called in context that "
931+
"cannot accept a set")));
932+
}
933+
924934
perlret = plperl_call_perl_func(prodesc, fcinfo);
925935

926936
/************************************************************
@@ -936,16 +946,6 @@ plperl_func_handler(PG_FUNCTION_ARGS)
936946

937947
if (prodesc->fn_retisset)
938948
{
939-
if (!rsi || !IsA(rsi, ReturnSetInfo) ||
940-
(rsi->allowedModes & SFRM_Materialize) == 0 ||
941-
rsi->expectedDesc == NULL)
942-
{
943-
ereport(ERROR,
944-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
945-
errmsg("set-valued function called in context that "
946-
"cannot accept a set")));
947-
}
948-
949949
/* If the Perl function returned an arrayref, we pretend that it
950950
* called return_next() for each element of the array, to handle
951951
* old SRFs that didn't know about return_next(). Any other sort

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy