Hi.
When running a query with a not exist table in SPI_exec. the process exit with -1 in SPI_exec function.
the error code SPI_ERROR_REL_NOT_FOUND never return.
I made a minimal reproduction code in https://github.com/Sasasu/worker_spi_table_not_exist
The core code is:
int spi = SPI_exec("select * from not_exist_table", 0);
// can not reach here
Assert(spi == SPI_ERROR_REL_NOT_FOUND);
Assert(spi == SPI_ERROR_REL_NOT_FOUND);
I think it is a bug, PG_TRY macro it not mentioned in SPI document.
The code inside SPI should be wrapped with PG_TRY macro.