postgresql/src
Tom Lane 83472de606 Improve readability and error detection of array_in().
Rewrite array_in() and its subroutines so that we make only one
pass over the input text, rather than two.  This requires
potentially re-pallocing the working arrays values[] and nulls[]
larger than our initial guess, but that cost will hopefully be made
up by avoiding duplicate parsing.  In any case this coding seems
much clearer and more straightforward than what we had before.

This also fixes array_in() to reject non-rectangular input (that is,
different brace depths in different parts of the input) more reliably
than before, and to give a better error message when it does so.
This is analogous to the plpython and plperl fixes in 0553528e7 and
f47004add.  Like those PLs, we now accept input such as '{{},{}}'
as a valid representation of an empty array, which we did not before.

Additionally, reject explicit array subscripts that are outside the
integer range (previously you just got whatever atoi() converted
them to), and make some other minor improvements in error reporting.

Although this is arguably a bug fix, it's also a behavioral change
that might trip somebody up, so no back-patch.

Tom Lane, Heikki Linnakangas, and Jian He.  Thanks to Alexander Lakhin
for the initial report and for review/testing.

Discussion: https://postgr.es/m/2794005.1683042087@sss.pgh.pa.us
2023-11-13 13:01:51 -05:00
..
backend Improve readability and error detection of array_in(). 2023-11-13 13:01:51 -05:00
bin Fix uninitialized slot array access during the upgrade. 2023-11-09 09:26:40 +05:30
common Make ResourceOwners more easily extensible. 2023-11-08 13:30:50 +02:00
fe_utils Remove distprep 2023-11-06 15:18:04 +01:00
include Improve readability and error detection of array_in(). 2023-11-13 13:01:51 -05:00
interfaces Call pqPipelineFlush from PQsendFlushRequest 2023-11-08 16:44:08 +01:00
makefiles Remove distprep 2023-11-06 15:18:04 +01:00
pl Make ResourceOwners more easily extensible. 2023-11-08 13:30:50 +02:00
port Remove distprep 2023-11-06 15:18:04 +01:00
template Use unnamed POSIX semaphores on Cygwin. 2023-01-06 10:33:28 +13:00
test Improve readability and error detection of array_in(). 2023-11-13 13:01:51 -05:00
timezone Remove distprep 2023-11-06 15:18:04 +01:00
tools Improve readability and error detection of array_in(). 2023-11-13 13:01:51 -05:00
tutorial Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.shlib Stop using "-multiply_defined suppress" on macOS. 2023-09-26 21:06:21 -04:00
meson.build Integrate pg_bsd_indent into our build/test infrastructure. 2023-02-12 12:22:21 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00