Change array_offset to return subscripts, not offsets
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 30 Mar 2015 19:13:21 +0000 (16:13 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 30 Mar 2015 19:13:21 +0000 (16:13 -0300)
commit97690ea6e86c412461dd5dc99953b829564d1a55
tree71b0865fd612c512fdb873ce3d4f30d05a56c45c
parent0853630159944bb3652336602ff5f7f62cd27a5a
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.
doc/src/sgml/array.sgml
doc/src/sgml/func.sgml
src/backend/utils/adt/array_userfuncs.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.h
src/include/utils/array.h
src/test/regress/expected/arrays.out
src/test/regress/sql/arrays.sql