git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0d3b49d)
Add missing support for the latest SPI status codes.
2023年2月22日 13:23:09 +0000 (13:23 +0000)
2023年2月22日 13:23:09 +0000 (13:23 +0000)
SPI_result_code_string() was missing support for SPI_OK_TD_REGISTER,
and in v15 and later, it was missing support for SPI_OK_MERGE, as was
pltcl_process_SPI_result().

The last of those would trigger an error if a MERGE was executed from
PL/Tcl. The others seem fairly innocuous, but worth fixing.

Back-patch to all supported branches. Before v15, this is just adding
SPI_OK_TD_REGISTER to SPI_result_code_string(), which is unlikely to
be seen by anyone, but seems worth doing for completeness.

Reviewed by Tom Lane.

Discussion:
https://postgr.es/m/CAEZATCUg8V%2BK%2BGcafOPqymxk84Y_prXgfe64PDoopjLFH6Z0Aw%40mail.gmail.com
https://postgr.es/m/CAEZATCUMe%2B_KedPMM9AxKqm%3DSZogSxjUcrMe%2BsakusZh3BFcQw%40mail.gmail.com


diff --git a/doc/src/sgml/spi.sgml b/doc/src/sgml/spi.sgml
index 7581661fc4ac00fa8a757436875bf1ac52f24fd0..651930aa3d6a406977e7262ab520916a1eed1d94 100644 (file)
--- a/doc/src/sgml/spi.sgml
+++ b/doc/src/sgml/spi.sgml
@@ -437,6 +437,15 @@ typedef struct SPITupleTable
</listitem>
</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>
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 61f03e39992534524d18545568cfcfbeb3052d6d..e3a170c38b84eb1c687bcd9bf4dc36e259f92bdd 100644 (file)
--- 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);
diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index 185d5bed99fbfa88c740be1b54cc6ced71aab8bd..499a9eaba811f00f36193ada27aa8ed68d77c6d8 100644 (file)
--- a/src/pl/tcl/pltcl.c
+++ b/src/pl/tcl/pltcl.c
@@ -2441,6 +2441,7 @@ pltcl_process_SPI_result(Tcl_Interp *interp,
case SPI_OK_INSERT:
case SPI_OK_DELETE:
case SPI_OK_UPDATE:
+ case SPI_OK_MERGE:
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(ntuples));
break;
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /