The return value of SPI_connect

From: "Hou, Zhijie" <houzj(dot)fnst(at)cn(dot)fujitsu(dot)com>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: The return value of SPI_connect
Date: 2020-09-28 03:42:21
Message-ID: 4bf7e10fcc0d4a7faf3143fde83fc577@G08CNEXMBPEKD05.g08.fujitsu.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

I found the function SPI_connect() has only one return value(SPI_OK_CONNECT).
But I also found that some places check the return value of SPI_connect() like the following:

if (SPI_connect() != SPI_OK_CONNECT)
elog(ERROR, "SPI_connect failed");

Is it necessary to check the return value of SPI_connect() ?

And in doc https://www.postgresql.org/docs/13/spi-spi-connect.html
It also says SPI_connect() can return SPI_ERROR_CONNECT on error.

May be we can make "int SPI_connect()" => "void SPI_connect()" and fix the doc ?

Best regards,
houzj

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2020-09-28 03:43:34 Re: New statistics for tuning WAL buffer size
Previous Message Abhijit Menon-Sen 2020-09-28 03:39:24 [PATCH] SET search_path += octopus