forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit83472de
committed
Improve readability and error detection of array_in().
Rewrite array_in() and its subroutines so that we make only onepass over the input text, rather than two. This requirespotentially re-pallocing the working arrays values[] and nulls[]larger than our initial guess, but that cost will hopefully be madeup by avoiding duplicate parsing. In any case this coding seemsmuch 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 reliablythan before, and to give a better error message when it does so.This is analogous to the plpython and plperl fixes in0553528 andf47004a. 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 theinteger range (previously you just got whatever atoi() convertedthem to), and make some other minor improvements in error reporting.Although this is arguably a bug fix, it's also a behavioral changethat might trip somebody up, so no back-patch.Tom Lane, Heikki Linnakangas, and Jian He. Thanks to Alexander Lakhinfor the initial report and for review/testing.Discussion:https://postgr.es/m/2794005.1683042087@sss.pgh.pa.us1 parent57d6a19 commit83472de
File tree
7 files changed
+789
-620
lines changed- doc/src/sgml
- src
- backend/utils/adt
- include/utils
- test/regress
- expected
- sql
- tools/pgindent
7 files changed
+789
-620
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
171 | 171 |
| |
172 | 172 |
| |
173 | 173 |
| |
174 |
| - | |
| 174 | + | |
| 175 | + | |
175 | 176 |
| |
176 | 177 |
| |
177 | 178 |
| |
|
0 commit comments
Comments
(0)