On 3/20/15 2:48 PM, Pavel Stehule wrote:
>
>
> 2015-03-20 18:47 GMT+01:00 Tom Lane <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>>:
>
> Alvaro Herrera <alvherre@2ndquadrant.com
> <mailto:alvherre@2ndquadrant.com>> writes:
> > Pavel Stehule wrote:
> >> I am thinking, so it is ok - it returns a offset, not position.
>
> > So you can't use it as a subscript? That sounds unfriendly. Almost
> > every function using this will be subtly broken.
>
> I concur; perhaps "offset" was the design intention, but it's wrong.
> The result should be a subscript.
>
>
> do you have any idea about name for this function? array_position is ok?
+1 on array_position. It's possible at some point we'll actually want
array_offset that does what it claims.
On another note, you mentioned elsewhere that it's not possible to
return anything other than an integer. Why can't there be a variation of
this function that returns an array of ndims-1 that is the slice where a
value was found?
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com