Joshua Tolley wrote:
> + plperl_call_data *save_call_data = current_call_data;
> + bool oldcontext = trusted_context;
> +
> + if (SPI_connect() != SPI_OK_CONNECT)
> + elog(ERROR, "could not connect to SPI manager");
>
...
> + current_call_data = (plperl_call_data *) palloc0(sizeof(plperl_call_data));
> + current_call_data->fcinfo = &fake_fcinfo;
> + current_call_data->prodesc = &desc;
>
I don't think this is done in the right order. If it is then this
comment in plperl_func_handler is wrong (as well as containing a typo):
/*
* Create the call_data beforing connecting to SPI, so that it is not
* allocated in the SPI memory context
*/
cheers
andrew