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

From Jim Nasby
Subject Re: proposal: searching in array function - array_position
Date
Msg-id 5508E6AE.3080603@BlueTreble.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
List pgsql-hackers
On 3/17/15 8:06 PM, Alvaro Herrera wrote:
> My main question regarding this patch is whether the behavior with MD
> arrays is useful at all.  Suppose I give it this:
>
> alvherre=# select array_offset('{{{1,2},{3,4},{5,6}},{{2,3},{4,5},{6,7}}}', 3);
>   array_offset
> --------------
>              3
> (1 fila)
>
> What can I do with the "3" value it returned?  Certainly not use it as
> an offset to get a slice of the original array.  The only thing that
> seems sensible to me here is to reject the whole thing with an error,
> that is, only accept 1-D arrays here.  We can later extend the function
> by allowing higher dimensionality as long as the second argument is an
> array one dimension less than the first argument.  But if we allow the
> case on its appearance, it's going to be difficult to change the
> behavior later.

+1

> Has a case been made for the current behavior?

Not that I remember. There was discussion about how this should properly 
support MD arrays.
-- 
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Strange assertion using VACOPT_FREEZE in vacuum.c
Next
From: Jim Nasby
Date:
Subject: Re: Reduce pinning in btree indexes