Re: About the return states of SPI_execute for plpy.execute().status()

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: arturocuya099(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: About the return states of SPI_execute for plpy.execute().status()
Date: 2021-02-17 19:43:58
Message-ID: a3e40711-51a2-4421-834f-d7c072a057ee@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Mon, Feb 15, 2021, at 12:25 PM, PG Doc comments form wrote:
> Hello. I'm using Postgres 9.3.25. I know it's an unsupported version but the
> documentation pages that I will mention stay the same between 9.3 and 13.
You should upgrade as soon as possible.

> In the docs for Database Access with PL/Python [1] it is mentioned that for
> the result object of plpy.execute(), the function status() can be called and
> it returns "The SPI_execute() return value". However when testing it the
> status function returns a number. In the specific test I made it returns
> "11". The problem is that the SPI_execute() documentation [2] does not
> mention which numeric constant each return code is assigned to. I would
> expect that the number 11 maps to the 11th code in the Return Value list,
> but only 10 non-negative values are listed. I think the PL/Python can be
> more explicit about the meaning of the status() return value. I have not
> read the whole PL/Python documentation yet, but if there is any resource
> that maps the raw integer that status() returns to the correct code for the
> SPI_execute() return value, it would be very helpful to mention it in the
> status() documentation.
It is referring to the SPI_execute() return values [1] whose mapped integers
are available in [2]. 11 refers to INSERT ... RETURNING. Maybe PL/Python should
expose these SPI constants too (if it doesn't).

[1] https://www.postgresql.org/docs/9.3/spi-spi-execute.html
[2] https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/include/executor/spi.h;h=81310e377f6b769c5aa306cf9aab932813dbeef8;hb=refs/heads/REL9_3_STABLE#l47

--
Euler Taveira
EDB https://www.enterprisedb.com/

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2021-02-17 19:58:47 Re: Re: About the return states of SPI_execute for plpy.execute().status()
Previous Message Magnus Hagander 2021-02-17 12:57:57 Re: CREATE TABLE typo