Re: proposal: searching in array function - array_position

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Marko Tiikkaja <marko(at)joh(dot)to>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Petr Jelinek <petr(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: proposal: searching in array function - array_position
Date: 2015-03-20 17:16:25
Message-ID: CAFj8pRA5t81AgvmwmCPNzJLZKeahENvG3QXrCrf+qGX3E6mqPQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2015-03-20 17:49 GMT+01:00 Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>:

> On 18 March 2015 at 19:03, Alvaro Herrera <alvherre(at)2ndquadrant(dot)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.
>

I am thinking, so it is ok - it returns a offset, not position.

Regards

Pavel

>
> Regards,
> Dean
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Christensen 2015-03-20 17:19:37 Re: [PATCH] two-arg current_setting() with fallback
Previous Message Joshua D. Drake 2015-03-20 16:52:35 Remove fsync ON/OFF as a visible option?