pgsql: Fix sample INSTR() functions in the plpgsql documentation.

2018-01-10 Thread Tom Lane
Fix sample INSTR() functions in the plpgsql documentation. These functions are stated to be Oracle-compatible, but they weren't. Yugo Nagata noticed that while our code returns zero for a zero or negative fourth parameter (occur_index), Oracle throws an error. Further testing by me showed that the

pgsql: Fix sample INSTR() functions in the plpgsql documentation.

2018-01-10 Thread Tom Lane
Fix sample INSTR() functions in the plpgsql documentation. These functions are stated to be Oracle-compatible, but they weren't. Yugo Nagata noticed that while our code returns zero for a zero or negative fourth parameter (occur_index), Oracle throws an error. Further testing by me showed that the

pgsql: Fix sample INSTR() functions in the plpgsql documentation.

2018-01-10 Thread Tom Lane
Fix sample INSTR() functions in the plpgsql documentation. These functions are stated to be Oracle-compatible, but they weren't. Yugo Nagata noticed that while our code returns zero for a zero or negative fourth parameter (occur_index), Oracle throws an error. Further testing by me showed that the

pgsql: Fix sample INSTR() functions in the plpgsql documentation.

2018-01-10 Thread Tom Lane
Fix sample INSTR() functions in the plpgsql documentation. These functions are stated to be Oracle-compatible, but they weren't. Yugo Nagata noticed that while our code returns zero for a zero or negative fourth parameter (occur_index), Oracle throws an error. Further testing by me showed that the

pgsql: Fix sample INSTR() functions in the plpgsql documentation.

2018-01-10 Thread Tom Lane
Fix sample INSTR() functions in the plpgsql documentation. These functions are stated to be Oracle-compatible, but they weren't. Yugo Nagata noticed that while our code returns zero for a zero or negative fourth parameter (occur_index), Oracle throws an error. Further testing by me showed that the

pgsql: Fix sample INSTR() functions in the plpgsql documentation.

2018-01-10 Thread Tom Lane
Fix sample INSTR() functions in the plpgsql documentation. These functions are stated to be Oracle-compatible, but they weren't. Yugo Nagata noticed that while our code returns zero for a zero or negative fourth parameter (occur_index), Oracle throws an error. Further testing by me showed that the

pgsql: Use portal pinning in PL/Perl and PL/Python

2018-01-10 Thread Peter Eisentraut
Use portal pinning in PL/Perl and PL/Python PL/pgSQL "pins" internally generated portals so that user code cannot close them by guessing their names. Add this functionality to PL/Perl and PL/Python as well, preventing users from manually closing cursors created by spi_query and plpy.cursor, respe

pgsql: Add tests for PL/pgSQL returning unnamed portals as refcursor

2018-01-10 Thread Peter Eisentraut
Add tests for PL/pgSQL returning unnamed portals as refcursor Existing tests only covered returning explicitly named portals as refcursor. The unnamed cursor case was recently broken without a test failing. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/5115854170

pgsql: Revert "Move portal pinning from PL/pgSQL to SPI"

2018-01-10 Thread Peter Eisentraut
Revert "Move portal pinning from PL/pgSQL to SPI" This reverts commit b3617cdfbba1b5381e9d1c6bc0839500e8eb7273. This broke returning unnamed cursors from PL/pgSQL functions. Apparently, there are no test cases for this. Branch -- master Details --- https://git.postgresql.org/pg/commitdi

pgsql: Remove dubious micro-optimization in ckpt_buforder_comparator().

2018-01-10 Thread Tom Lane
Remove dubious micro-optimization in ckpt_buforder_comparator(). It seems incorrect to assume that the list of CkptSortItems can never contain duplicate page numbers: concurrent activity could result in some page getting dropped from a low-numbered buffer and later loaded into a high-numbered buff

pgsql: Remove dubious micro-optimization in ckpt_buforder_comparator().

2018-01-10 Thread Tom Lane
Remove dubious micro-optimization in ckpt_buforder_comparator(). It seems incorrect to assume that the list of CkptSortItems can never contain duplicate page numbers: concurrent activity could result in some page getting dropped from a low-numbered buffer and later loaded into a high-numbered buff

pgsql: Remove dubious micro-optimization in ckpt_buforder_comparator().

2018-01-10 Thread Tom Lane
Remove dubious micro-optimization in ckpt_buforder_comparator(). It seems incorrect to assume that the list of CkptSortItems can never contain duplicate page numbers: concurrent activity could result in some page getting dropped from a low-numbered buffer and later loaded into a high-numbered buff

pgsql: Add missing "return" statement to accumulate_append_subpath.

2018-01-10 Thread Robert Haas
Add missing "return" statement to accumulate_append_subpath. Without this, Parallel Append can end up with extra children. Report by Rajkumar Raghuwanshi. Fix by Amit Khandekar. Brown paper bag bug by me. Discussion: http://postgr.es/m/CAKcux6mBF-NiddyEe9LwymoUC5+wh8bQJ=uk2gGkOE+L8cv=l...@mai

pgsql: Move portal pinning from PL/pgSQL to SPI

2018-01-10 Thread Peter Eisentraut
Move portal pinning from PL/pgSQL to SPI PL/pgSQL "pins" internally generated (unnamed) portals so that user code cannot close them by guessing their names. This logic is also useful in other languages and really for any code. So move that logic into SPI. An unnamed portal obtained through SPI_c

pgsql: Give more accurate error message for dropping pinned portal

2018-01-10 Thread Peter Eisentraut
Give more accurate error message for dropping pinned portal The previous code gave the same error message for attempting to drop pinned and active portals, but those are separate states, so give separate error messages. Branch -- master Details --- https://git.postgresql.org/pg/commitdif

Re: pgsql: Improve scripting language in pgbench

2018-01-10 Thread Teodor Sigaev
Thank you very much, applied Thomas Munro wrote: On Wed, Jan 10, 2018 at 4:02 AM, Teodor Sigaev wrote: Improve scripting language in pgbench Hi Teodor, I think this commit might have lost a fix from 0aa1d489ea756b96b6d5573692ae9cd5d143c2a5. bowerbird and jacana now fail when they see an un

pgsql: Fix allowing of leading zero on exponents in pgbench test result

2018-01-10 Thread Teodor Sigaev
Fix allowing of leading zero on exponents in pgbench test results Commit bc7fa0c15c590ddf4872e426abd76c2634f22aca accidentally lost fixes of 0aa1d489ea756b96b6d5573692ae9cd5d143c2a5 commit. Thanks to Thomas Munro Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/d16c