public inbox for [email protected]
help / color / mirror / Atom feedFrom: Dean Rasheed <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: Missing cases from SPI_result_code_string()
Date: Mon, 20 Feb 2023 18:52:16 +0000
Message-ID: <CAEZATCUg8V+K+GcafOPqymxk84Y_prXgfe64PDoopjLFH6Z0Aw@mail.gmail.com> (raw)
Another one noticed from the MERGE RETURNING patch -- the switch
statement in SPI_result_code_string() is missing cases for
SPI_OK_TD_REGISTER and SPI_OK_MERGE.
The SPI_OK_TD_REGISTER case goes back all the way, so I suppose it
should be back-patched to all supported branches, though evidently
this is not something anyone is likely to care about.
The SPI_OK_MERGE case is perhaps a little more visible (e.g., execute
MERGE from PL/Perl using $rv = spi_exec_query() and then examine
$rv->{status}). It's also missing from the docs for SPI_Execute().
Having tested that it now works as expected, I don't think there's
much point in adding a regression test case for it though.
Regards,
Dean
Attachments:
[text/x-patch] SPI_result_code_string.patch (1.1K, ../CAEZATCUg8V+K+GcafOPqymxk84Y_prXgfe64PDoopjLFH6Z0Aw@mail.gmail.com/2-SPI_result_code_string.patch)
download | inline diff:
diff --git a/doc/src/sgml/spi.sgml b/doc/src/sgml/spi.sgml
new file mode 100644
index 7581661..651930a
--- a/doc/src/sgml/spi.sgml
+++ b/doc/src/sgml/spi.sgml
@@ -438,6 +438,15 @@ typedef struct SPITupleTable
</varlistentry>
<varlistentry>
+ <term><symbol>SPI_OK_MERGE</symbol></term>
+ <listitem>
+ <para>
+ if a <command>MERGE</command> was executed
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><symbol>SPI_OK_INSERT_RETURNING</symbol></term>
<listitem>
<para>
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
new file mode 100644
index 61f03e3..e3a170c
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -2029,6 +2029,10 @@ SPI_result_code_string(int code)
return "SPI_OK_REL_REGISTER";
case SPI_OK_REL_UNREGISTER:
return "SPI_OK_REL_UNREGISTER";
+ case SPI_OK_TD_REGISTER:
+ return "SPI_OK_TD_REGISTER";
+ case SPI_OK_MERGE:
+ return "SPI_OK_MERGE";
}
/* Unrecognized code ... return something useful ... */
sprintf(buf, "Unrecognized SPI code %d", code);
view thread (3+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Missing cases from SPI_result_code_string()
In-Reply-To: <CAEZATCUg8V+K+GcafOPqymxk84Y_prXgfe64PDoopjLFH6Z0Aw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox