SPI_connect, SPI_connect_ext return type

Stepan Neretin <sndcppg@gmail.com>

From: Stepan <sndcppg@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2024-08-10T13:55:46Z
Lists: pgsql-hackers

Attachments

Hi, hackers! If you look at the code in the src/backend/executor/spi.c file,
you will see the SPI_connect function familiar to many there, which
internally simply calls SPI_connect_ext. The return type is int, at the end
it says return SPI_OK_CONNECT;
It confuses me that nothing but OK, judging by the code, can return.(I
understand that earlier, before 1833f1a1, it could also return
SPI_ERROR_CONNECT). Therefore, I suggest making the returned value void
instead of int and not checking the returned value. What do you think about
this?
Best Regards, Stepan Neretin.

Commits

  1. Don't bother checking the result of SPI_connect[_ext] anymore.