Commit 3feb6ace authored by Michael Paquier's avatar Michael Paquier

Check after errors of SPI_execute() in xml.c

SPI gets used to build a list of relation OIDs for XML object
generation, and one code path building a list uses SPI_execute() without
looking at errors it produces.  So fix that.

Author: Mark Dilger
Reviewed-by: Michael Paquier, Pavel Stehule
Discussion: https://postgr.es/m/17d30445-4862-7917-170f-84328dcd292d@gmail.com
parent 6e3e6cc0
......@@ -2461,8 +2461,12 @@ query_to_oid_list(const char *query)
{
uint64 i;
List *list = NIL;
int spi_result;
SPI_execute(query, true, 0);
spi_result = SPI_execute(query, true, 0);
if (spi_result != SPI_OK_SELECT)
elog(ERROR, "SPI_execute returned %s for %s",
SPI_result_code_string(spi_result), query);
for (i = 0; i < SPI_processed; i++)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment