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 17:25:29
Message-ID: CAKFQuwbKhyAUfZYK2ZpkWWB2dW9p-Xu9DR1Vg5_oOWwgnWmogg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 10, 2024 at 9:29 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > On Saturday, August 10, 2024, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> 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.
>
> I don't
> know if that usage pattern has propagated outside Postgres core,
> but it might've.

I'd give it decent odds since our example usage doesn't include the test.

https://www.postgresql.org/docs/current/spi-examples.html

/* Convert given text object to a C string */
command = text_to_cstring(PG_GETARG_TEXT_PP(0));
cnt = PG_GETARG_INT32(1);

SPI_connect();

ret = SPI_exec(command, cnt);

proc = SPI_processed;

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2024-08-10 17:50:55 Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)
Previous Message Alexander Korotkov 2024-08-10 17:18:53 Re: [HACKERS] make async slave to wait for lsn to be replayed