public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Eisentraut <[email protected]>
To: Tom Lane <[email protected]>
To: Stepan <[email protected]>
Cc: [email protected]
Subject: Re: SPI_connect, SPI_connect_ext return type
Date: Mon, 12 Aug 2024 14:39:04 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CAMaYL5Z9Uk8cD9qGz9QaZ2UBJFOu7jFx5Mwbznz-1tBbPDQZow@mail.gmail.com>
	<[email protected]>

On 10.08.24 16:12, Tom Lane wrote:
> Stepan <[email protected]> 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.

Here is a previous discussion: 
https://www.postgresql.org/message-id/flat/1356682025.20017.4.camel%40vanquo.pezone.net

I like the idea that we would keep the API but convert most errors to 
exceptions.







view thread (11+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: SPI_connect, SPI_connect_ext return type
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox