pg.ddx.io pgsql-docs@postgresql.org mailing list archive
help / color / mirror / Atom feedAbout the return states of SPI_execute for plpy.execute().status()
3+ messages / 3 participants
[nested] [flat]
* About the return states of SPI_execute for plpy.execute().status()
@ 2021-02-15 15:25 PG Doc comments form <noreply@postgresql.org>
2021-02-17 19:43 ` Re: About the return states of SPI_execute for plpy.execute().status() Euler Taveira <euler@eulerto.com>
0 siblings, 1 reply; 3+ messages in thread
From: PG Doc comments form @ 2021-02-15 15:25 UTC (permalink / raw)
To: pgsql-docs@lists.postgresql.org; +Cc: arturocuya099@gmail.com
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/13/spi-spi-execute.html
Description:
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.
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.
[1] https://www.postgresql.org/docs/current/plpython-database.html
[2] https://www.postgresql.org/docs/current/spi-spi-execute.html
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: About the return states of SPI_execute for plpy.execute().status()
2021-02-15 15:25 About the return states of SPI_execute for plpy.execute().status() PG Doc comments form <noreply@postgresql.org>
@ 2021-02-17 19:43 ` Euler Taveira <euler@eulerto.com>
2021-02-17 19:58 ` Re: Re: About the return states of SPI_execute for plpy.execute().status() Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: Euler Taveira @ 2021-02-17 19:43 UTC (permalink / raw)
To: arturocuya099@gmail.com; pgsql-docs@lists.postgresql.org
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=81310e377f...
--
Euler Taveira
EDB https://www.enterprisedb.com/
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Re: About the return states of SPI_execute for plpy.execute().status()
2021-02-15 15:25 About the return states of SPI_execute for plpy.execute().status() PG Doc comments form <noreply@postgresql.org>
2021-02-17 19:43 ` Re: About the return states of SPI_execute for plpy.execute().status() Euler Taveira <euler@eulerto.com>
@ 2021-02-17 19:58 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2021-02-17 19:58 UTC (permalink / raw)
To: Euler Taveira <euler@eulerto.com>; +Cc: arturocuya099@gmail.com; pgsql-docs@lists.postgresql.org
"Euler Taveira" <euler@eulerto.com> writes:
> 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).
I wouldn't be in too much of a hurry to do that, because there's been
repeated discussion of removing (or at least obsoleting) most of those
codes in favor of throwing regular errors for the cases that represent
error conditions. Better to wait to change plpython until after that
dust settles.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2021-02-17 19:58 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-02-15 15:25 About the return states of SPI_execute for plpy.execute().status() PG Doc comments form <noreply@postgresql.org>
2021-02-17 19:43 ` Euler Taveira <euler@eulerto.com>
2021-02-17 19:58 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox