Skip to content

Commit d0460a3

Browse files
committed
Add missing support for the latest SPI status codes.
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
1 parent 0d3b49d commit d0460a3

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

doc/src/sgml/spi.sgml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,15 @@ typedef struct SPITupleTable
437437
</listitem>
438438
</varlistentry>
439439

440+
<varlistentry>
441+
<term><symbol>SPI_OK_MERGE</symbol></term>
442+
<listitem>
443+
<para>
444+
if a <command>MERGE</command> was executed
445+
</para>
446+
</listitem>
447+
</varlistentry>
448+
440449
<varlistentry>
441450
<term><symbol>SPI_OK_INSERT_RETURNING</symbol></term>
442451
<listitem>

src/backend/executor/spi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,6 +2029,10 @@ SPI_result_code_string(int code)
20292029
return "SPI_OK_REL_REGISTER";
20302030
case SPI_OK_REL_UNREGISTER:
20312031
return "SPI_OK_REL_UNREGISTER";
2032+
case SPI_OK_TD_REGISTER:
2033+
return "SPI_OK_TD_REGISTER";
2034+
case SPI_OK_MERGE:
2035+
return "SPI_OK_MERGE";
20322036
}
20332037
/* Unrecognized code ... return something useful ... */
20342038
sprintf(buf, "Unrecognized SPI code %d", code);

src/pl/tcl/pltcl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2441,6 +2441,7 @@ pltcl_process_SPI_result(Tcl_Interp *interp,
24412441
case SPI_OK_INSERT:
24422442
case SPI_OK_DELETE:
24432443
case SPI_OK_UPDATE:
2444+
case SPI_OK_MERGE:
24442445
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(ntuples));
24452446
break;
24462447

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy