pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Change array_offset to return subscripts, not offsets
Date: Mon, 30 Mar 2015 19:29:14 +0000
Message-ID: <E1YcfN4-0000S6-B1@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1YcfN4-0000S6-B1@gemulon.postgresql.org>
Permalink:  ../E1YcfN4-0000S6-B1@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1YcfN4-0000S6-B1@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Change array_offset to return subscripts, not offsets
  In-Reply-To: <E1YcfN4-0000S6-B1@gemulon.postgresql.org>
  References: <E1YcfN4-0000S6-B1@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox