Re: SPI_connect, SPI_connect_ext return type - Mailing list pgsql-hackers

From Tom Lane
Subject Re: SPI_connect, SPI_connect_ext return type
Date
Msg-id 3133982.1723299124@sss.pgh.pa.us
Whole thread Raw
In response to SPI_connect, SPI_connect_ext return type  (Stepan <sndcppg@gmail.com>)
Responses Re: SPI_connect, SPI_connect_ext return type
Re: SPI_connect, SPI_connect_ext return type
Re: SPI_connect, SPI_connect_ext return type
List pgsql-hackers
Stepan <sndcppg@gmail.com> writes:
> 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?

That would break a lot of code (much of it not under our control) to
little purpose; it would also foreclose the option to return to using
SPI_ERROR_CONNECT someday.

We go to a lot of effort to keep the SPI API as stable as we can
across major versions, so I don't see why we'd just randomly make
an API-breaking change like this.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Stepan
Date:
Subject: Re: SPI_connect, SPI_connect_ext return type
Next
From: vignesh C
Date:
Subject: Re: Pgoutput not capturing the generated columns