On 12/5/17 14:45, Tom Lane wrote:
> On the whole it seems like it might be better to dodge this whole business
> of changing "result" inside the TRY. You could do that if you did
> something like
>
> result->rows = PyList_New(rows);
> - if (!result->rows)
> - {
> - Py_DECREF(result);
> - result = NULL;
> - }
> - else
> + if (result->rows)
> {
> PLy_input_setup_tuple(&ininfo, tuptable->tupdesc,
>
> and then add after the PG_END_TRY
>
> if (!result->rows)
> {
> Py_DECREF(result);
> result = NULL;
> }
Yeah, that looks much better. Next try attached.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services