Re: SPI_connect, SPI_connect_ext return type

Stepan Neretin <sndcppg@gmail.com>

From: Stepan Neretin <sndcppg@gmail.com>
To: "David G. Johnston" <david.g.johnston@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2024-08-10T18:34:43Z
Lists: pgsql-hackers

Attachments

> I'd give it decent odds since our example usage doesn't include the test.
> https://www.postgresql.org/docs/current/spi-examples.html

https://www.postgresql.org/docs/devel/trigger-example.html
<https://www.postgresql.org/docs/current/spi-examples.html>

> /* connect to SPI manager */

>    if ((ret = SPI_connect()) < 0)
>        elog(ERROR, "trigf (fired %s): SPI_connect returned %d", when, ret);


in this page check include in the example.
I think we need to give examples of one kind. If there is no void in
the code, then there should be checks everywhere (at least in the
documentation).

 What do you think about the attached patch?

Best Regards, Stepan Neretin.

Commits

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