v1-0001-Fix-SPI-Documentation.patch
text/x-patch
Filename: v1-0001-Fix-SPI-Documentation.patch
Type: text/x-patch
Part: 0
Patch
Format: format-patch
Series: patch v1-0001
Subject: Fix SPI Documentation - Standardized the example in the execq function to ensure consistent error handling. Now, the error from SPI_connect() is checked and reported uniformly. - Removed the SPI_ERROR_CONNECT return entry, reflecting that there is now only one return value for SPI_connect_ext.
| File | + | − |
|---|---|---|
| doc/src/sgml/spi.sgml | 5 | 10 |
From 4c8d6d9ae6f8843bc6d1ad203d629df09657b039 Mon Sep 17 00:00:00 2001
From: Stepan Neretin <sndcppg@gmail.com>
Date: Sat, 10 Aug 2024 21:30:37 +0300
Subject: [PATCH v1] Fix SPI Documentation - Standardized the example in the
execq function to ensure consistent error handling. Now, the error from
SPI_connect() is checked and reported uniformly. - Removed the
SPI_ERROR_CONNECT return entry, reflecting that there is now only one return
value for SPI_connect_ext.
---
doc/src/sgml/spi.sgml | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/doc/src/sgml/spi.sgml b/doc/src/sgml/spi.sgml
index 7d154914b9..fdd31c3fdf 100644
--- a/doc/src/sgml/spi.sgml
+++ b/doc/src/sgml/spi.sgml
@@ -126,16 +126,10 @@ int SPI_connect_ext(int <parameter>options</parameter>)
</para>
</listitem>
</varlistentry>
-
- <varlistentry>
- <term><symbol>SPI_ERROR_CONNECT</symbol></term>
- <listitem>
- <para>
- on error
- </para>
- </listitem>
- </varlistentry>
</variablelist>
+ <para>
+ All failure cases are reported via <literal>elog/ereport</literal>.
+ </para>
</refsect1>
</refentry>
@@ -5281,7 +5275,8 @@ execq(PG_FUNCTION_ARGS)
command = text_to_cstring(PG_GETARG_TEXT_PP(0));
cnt = PG_GETARG_INT32(1);
- SPI_connect();
+ if ((ret = SPI_connect()) < 0)
+ elog(ERROR, "SPI_connect returned %d");
ret = SPI_exec(command, cnt);
--
2.43.0