Bug in documentation: https://www.postgresql.org/docs/current/spi-examples.html
| От | Curt Kolovson |
|---|---|
| Тема | Bug in documentation: https://www.postgresql.org/docs/current/spi-examples.html |
| Дата | |
| Msg-id | CANhYJV6HWtgz_qjx_APfK0PAgLUzY-2vjLuj7i_o=TZF1LAQew@mail.gmail.com обсуждение исходный текст |
| Ответы |
Re: Bug in documentation: https://www.postgresql.org/docs/current/spi-examples.html
|
| Список | pgsql-docs |
The actual results (shown below) are different than shown on this doc
page. The reason is because the second parameter to the UDF that is
passed to SPI_exec is the maximum number of rows to return, or 0 for
no limit. It is not the maximum number of rows to process. In the case
of "SELECT execq('INSERT INTO a SELECT x + 2 FROM a', 1)", it returned
0 rows, but it inserted (processed) 2 rows. This example should be
corrected.
Curt
db=# SELECT execq('CREATE TABLE a (x integer)', 0);
execq
-------
0
(1 row)
db=# INSERT INTO a VALUES (execq('INSERT INTO a VALUES (0)', 0));
INSERT 0 1
db=# SELECT execq('SELECT * FROM a', 0);
INFO: EXECQ: 0
INFO: EXECQ: 1
execq
-------
2
(1 row)
db=# SELECT execq('INSERT INTO a SELECT x + 2 FROM a', 1);
execq
-------
2
(1 row)
db=# SELECT execq('SELECT * FROM a', 10);
INFO: EXECQ: 0
INFO: EXECQ: 1
INFO: EXECQ: 2
INFO: EXECQ: 3
execq
-------
4
(1 row)
В списке pgsql-docs по дате отправления: