rv;
PLyPlanObject *plan;
volatile MemoryContext oldcontext;
+ PyObject *ret;
if (list != NULL)
{
oldcontext = CurrentMemoryContext;
PG_TRY();
{
- char *nulls = palloc(nargs * sizeof(char));
+ char *nulls;
volatile int j;
+ if (nargs > 0)
+ nulls = palloc(nargs * sizeof(char));
+ else
+ nulls = NULL;
+
for (j = 0; j < nargs; j++)
{
PyObject *elem;
rv = SPI_execute_plan(plan->plan, plan->values, nulls,
PLy_curr_procedure->fn_readonly, limit);
+ ret = PLy_spi_execute_fetch_result(SPI_tuptable, SPI_processed, rv);
- pfree(nulls);
+ if (nargs > 0)
+ pfree(nulls);
}
PG_CATCH();
{
}
}
- return PLy_spi_execute_fetch_result(SPI_tuptable, SPI_processed, rv);
+ return ret;
}
static PyObject *
{
int rv;
volatile MemoryContext oldcontext;
+ PyObject *ret;
oldcontext = CurrentMemoryContext;
PG_TRY();
{
pg_verifymbstr(query, strlen(query), false);
rv = SPI_execute(query, PLy_curr_procedure->fn_readonly, limit);
+ ret = PLy_spi_execute_fetch_result(SPI_tuptable, SPI_processed, rv);
}
PG_CATCH();
{
return NULL;
}
- return PLy_spi_execute_fetch_result(SPI_tuptable, SPI_processed, rv);
+ return ret;
}
static PyObject *