Re: SPI_connect, SPI_connect_ext return type

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Stepan <sndcppg(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: SPI_connect, SPI_connect_ext return type
Date: 2024-08-10 15:18:31
Message-ID: CAKFQuwZLscENsYRvCAo5DqLAfD8zLNoA006JYuQCdXNOR2wvOw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Saturday, August 10, 2024, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Stepan <sndcppg(at)gmail(dot)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.
>

I suggest we document it as deprecated and insist any future attempt to
implement a return-on-error connection function define a completely new
function.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2024-08-10 15:35:46 Re: optimizing pg_upgrade's once-in-each-database steps
Previous Message Nathan Bossart 2024-08-10 15:17:27 Re: optimizing pg_upgrade's once-in-each-database steps