Change array_offset to return subscripts, not offsets
Alvaro Herrera <alvherre@alvh.no-ip.org>
Change array_offset to return subscripts, not offsets ... and rename it and its sibling array_offsets to array_position and array_positions, to account for the changed behavior. Having the functions return subscripts better matches existing practice, and is better suited to using the result value as a subscript into the array directly. For one-based arrays, the new definition is identical to what was originally committed. (We use the term "subscript" in the documentation, which is what we use whenever we talk about arrays; but the functions themselves are named using the word "position" to match the standard-defined POSITION() functions.) Author: Pavel Stěhule Behavioral problem noted by Dean Rasheed.
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/array.sgml | modified | +9 −9 |
| doc/src/sgml/func.sgml | modified | +11 −11 |
| src/backend/utils/adt/array_userfuncs.c | modified | +29 −25 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/catalog/pg_proc.h | modified | +3 −3 |
| src/include/utils/array.h | modified | +3 −3 |
| src/test/regress/expected/arrays.out | modified | +60 −48 |
| src/test/regress/sql/arrays.sql | modified | +21 −18 |