pgsql: Change array_offset to return subscripts, not offsets

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Change array_offset to return subscripts, not offsets
Date: 2015-03-30 19:29:14
Message-ID: E1YcfN4-0000S6-B1@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/97690ea6e86c412461dd5dc99953b829564d1a55

Modified Files
--------------
doc/src/sgml/array.sgml | 18 +++---
doc/src/sgml/func.sgml | 22 +++----
src/backend/utils/adt/array_userfuncs.c | 54 +++++++++-------
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.h | 6 +-
src/include/utils/array.h | 6 +-
src/test/regress/expected/arrays.out | 108 +++++++++++++++++--------------
src/test/regress/sql/arrays.sql | 39 +++++------
8 files changed, 137 insertions(+), 118 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-03-30 19:38:16 Re: [COMMITTERS] pgsql: Centralize definition of integer limits.
Previous Message Alvaro Herrera 2015-03-30 19:03:16 pgsql: Fix lost persistence setting during REINDEX INDEX