Re: proposal: searching in array function - array_position - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: proposal: searching in array function - array_position
Date
Msg-id CAEZATCXHb+tv8YYo4=XRoBzCOywTrM4cncqR57D4ZM7WdFomiQ@mail.gmail.com
Whole thread Raw
In response to Re: proposal: searching in array function - array_position  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: proposal: searching in array function - array_position  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
On 18 March 2015 at 19:03, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
> Pushed after adding error checks there and fixing the docs to match.
> Please verify.
>

There's an issue when the array's lower bound isn't 1:

select array_offset('[2:4]={1,2,3}'::int[], 1);array_offset
--------------           1
(1 row)

whereas I would expect this to return 2. Similarly for
array_offsets(), so the offsets can be used as indexes into the
original array.

Regards,
Dean



pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: [PATCH] two-arg current_setting() with fallback
Next
From: Pavel Stehule
Date:
Subject: Re: proposal: searching in array function - array_position