Thread: Missing cases from SPI_result_code_string()

Missing cases from SPI_result_code_string()

From
Dean Rasheed
Date:
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

Attachment

Re: Missing cases from SPI_result_code_string()

From
Tom Lane
Date:
Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> 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.

Ugh.  Grepping around, it looks like pltcl_process_SPI_result
is missing a case for SPI_OK_MERGE as well.

            regards, tom lane



Re: Missing cases from SPI_result_code_string()

From
Dean Rasheed
Date:
On Mon, 20 Feb 2023 at 19:39, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Ugh.  Grepping around, it looks like pltcl_process_SPI_result
> is missing a case for SPI_OK_MERGE as well.
>

Yes, I was about to post a patch for that too. That's the last case
that I found, looking around.

Regards,
Dean



Re: Missing cases from SPI_result_code_string()

From
Dean Rasheed
Date:
On Mon, 20 Feb 2023 at 19:49, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
>
> On Mon, 20 Feb 2023 at 19:39, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >
> > Ugh.  Grepping around, it looks like pltcl_process_SPI_result
> > is missing a case for SPI_OK_MERGE as well.
>
> Yes, I was about to post a patch for that too. That's the last case
> that I found, looking around.
>

OK, I've pushed fixes for those.

Regards,
Dean