Re: [HACKERS] proposal: searching in array function - array_position

2015-03-30 Thread Pavel Stehule
2015-03-30 21:30 GMT+02:00 Alvaro Herrera : > Pavel Stehule wrote: > > 2015-03-22 11:30 GMT+01:00 Dean Rasheed : > > > > In the public docs, you should s/position/subscript because that's the > > > term used throughout the docs for an index into an array. I still like > > > the name array_position

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-30 Thread Alvaro Herrera
Pavel Stehule wrote: > 2015-03-22 11:30 GMT+01:00 Dean Rasheed : > > In the public docs, you should s/position/subscript because that's the > > term used throughout the docs for an index into an array. I still like > > the name array_position() for the function though, because it's > > consistent

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-22 Thread Pavel Stehule
2015-03-22 11:30 GMT+01:00 Dean Rasheed : > On 22 March 2015 at 06:11, Pavel Stehule wrote: > > Hi > > > > here is updated patch with array_position, array_positions > implementation. > > > > It is based on committed code - so please, revert commit > > 13dbc7a824b3f905904cab51840d37f31a07a9ef and

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-22 Thread Dean Rasheed
On 22 March 2015 at 06:11, Pavel Stehule wrote: > Hi > > here is updated patch with array_position, array_positions implementation. > > It is based on committed code - so please, revert commit > 13dbc7a824b3f905904cab51840d37f31a07a9ef and apply this patch > I checked this and the changes look go

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-21 Thread Pavel Stehule
Hi here is updated patch with array_position, array_positions implementation. It is based on committed code - so please, revert commit 13dbc7a824b3f905904cab51840d37f31a07a9ef and apply this patch Regards Pavel 2015-03-20 18:29 GMT+01:00 Alvaro Herrera : > Pavel Stehule wrote: > > 2015-03-20

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-21 Thread Dean Rasheed
>>> 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. > +1 for array_position. -1 for keeping array_offset. I'm not convinced that there are sufficient use

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-20 Thread Pavel Stehule
2015-03-21 0:27 GMT+01:00 Jim Nasby : > On 3/20/15 2:48 PM, Pavel Stehule wrote: > >> >> >> 2015-03-20 18:47 GMT+01:00 Tom Lane > >: >> >> Alvaro Herrera > > writes: >> > Pavel Stehule wrote: >> >> I am thinking, so it is

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-20 Thread Jim Nasby
On 3/20/15 2:48 PM, Pavel Stehule wrote: 2015-03-20 18:47 GMT+01:00 Tom Lane mailto:t...@sss.pgh.pa.us>>: Alvaro Herrera mailto:alvhe...@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

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-20 Thread Pavel Stehule
2015-03-20 18:47 GMT+01:00 Tom Lane : > Alvaro Herrera 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

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-20 Thread Tom Lane
Alvaro Herrera 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

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-20 Thread Pavel Stehule
2015-03-20 18:29 GMT+01:00 Alvaro Herrera : > Pavel Stehule wrote: > > 2015-03-20 17:49 GMT+01:00 Dean Rasheed : > > > > > 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

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-20 Thread Alvaro Herrera
Pavel Stehule wrote: > 2015-03-20 17:49 GMT+01:00 Dean Rasheed : > > > 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.

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-20 Thread Pavel Stehule
2015-03-20 17:49 GMT+01:00 Dean Rasheed : > On 18 March 2015 at 19:03, Alvaro Herrera > 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[],

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-20 Thread Dean Rasheed
On 18 March 2015 at 19:03, Alvaro Herrera 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) wh

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-19 Thread Alvaro Herrera
Pavel Stehule wrote: > 2015-03-18 20:03 GMT+01:00 Alvaro Herrera : > > Pushed after adding error checks there and fixing the docs to match. > > Please verify. > > > > it is looking well, thank you. Thanks for checking. > small issue - there is not documented, so multidimensional arrays are not

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-19 Thread Pavel Stehule
2015-03-18 20:03 GMT+01:00 Alvaro Herrera : > Pavel Stehule wrote: > > 2015-03-18 12:41 GMT+01:00 Marko Tiikkaja : > > > >> I am thinking, so this behave is correct (there is no other > > >> possible), but it is only corner case for this functionality - and > > >> if you are thinking, so better to

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-18 Thread Alvaro Herrera
Pavel Stehule wrote: > 2015-03-18 12:41 GMT+01:00 Marko Tiikkaja : > >> I am thinking, so this behave is correct (there is no other > >> possible), but it is only corner case for this functionality - and > >> if you are thinking, so better to disallow it, I am not against. My > >> main focus is 1N

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-18 Thread Pavel Stehule
2015-03-18 12:41 GMT+01:00 Marko Tiikkaja : > On 3/18/15 12:27 PM, Pavel Stehule wrote: > >> 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 a

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-18 Thread Marko Tiikkaja
On 3/18/15 12:27 PM, Pavel Stehule wrote: 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_o

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-18 Thread Pavel Stehule
2015-03-18 3:45 GMT+01:00 Jim Nasby : > 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);

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-17 Thread Jim Nasby
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)

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-17 Thread Alvaro Herrera
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

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-12 Thread Jim Nasby
On 3/11/15 1:19 AM, Pavel Stehule wrote: 2015-03-11 2:57 GMT+01:00 Robert Haas mailto:robertmh...@gmail.com>>: On Tue, Mar 10, 2015 at 5:53 PM, Jim Nasby mailto:jim.na...@bluetreble.com>> wrote: > I don't think we need both array_offset and array_offset_start; can't both > SQL functi

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-12 Thread Pavel Stehule
2015-03-10 16:53 GMT+01:00 Jim Nasby : > On 3/10/15 9:30 AM, Robert Haas wrote: > >> On Sat, Mar 7, 2015 at 1:06 PM, Petr Jelinek >> wrote: >> >>> You still duplicate the type cache code, but many other array functions >>> do >>> that too so I will not hold that against you. (Maybe somebody shoul

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-12 Thread Jim Nasby
On 3/10/15 9:30 AM, Robert Haas wrote: On Sat, Mar 7, 2015 at 1:06 PM, Petr Jelinek wrote: You still duplicate the type cache code, but many other array functions do that too so I will not hold that against you. (Maybe somebody should write separate patch that would put all that duplicate code

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-11 Thread Pavel Stehule
2015-03-11 22:50 GMT+01:00 Jim Nasby : > On 3/11/15 4:37 PM, Pavel Stehule wrote: > + /* > + * array_offset - returns the offset of a value in an array > (array_offset and > + * array_offset_start are wrappers for safe call (look on opr_sanity > test) a > + * array_offset_common function. > +

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-11 Thread Jim Nasby
On 3/11/15 4:37 PM, Pavel Stehule wrote: + /* + * array_offset - returns the offset of a value in an array (array_offset and + * array_offset_start are wrappers for safe call (look on opr_sanity test) a + * array_offset_common function. + * + * Returns NULL when value is not found. It uses

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-11 Thread Pavel Stehule
2015-03-11 22:14 GMT+01:00 Jim Nasby : > On 3/11/15 1:29 AM, Pavel Stehule wrote: > >> >> What is this comment supposed to mean? There is no 'width_array'... >> >> >> It is typo (I am sorry) - should be width_bucket(, array) >> >> http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-11 Thread Jim Nasby
On 3/11/15 1:29 AM, Pavel Stehule wrote: What is this comment supposed to mean? There is no 'width_array'... It is typo (I am sorry) - should be width_bucket(, array) http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=e80252d424278abf65b624669c8e6b3fe8587cac The code is si

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-11 Thread Jim Nasby
On 3/10/15 5:25 PM, Tom Lane wrote: Jim Nasby writes: That said, this pattern with fn_extra is repeated a lot, even just in the backend (not counting contrib or extensions). It would be nice if there was generic support for this. What do you mean by "generic support"? Most of those functions

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-10 Thread Pavel Stehule
2015-03-10 22:53 GMT+01:00 Jim Nasby : > On 2/22/15 5:19 AM, Pavel Stehule wrote: > >> >> >> 2015-02-22 3:00 GMT+01:00 Petr Jelinek > >: >> >> On 28/01/15 08:15, Pavel Stehule wrote: >> >> >> >> 2015-01-28 0:01 GMT+01:00 Jim Nasby >

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-10 Thread Pavel Stehule
2015-03-11 2:57 GMT+01:00 Robert Haas : > On Tue, Mar 10, 2015 at 5:53 PM, Jim Nasby > wrote: > > I don't think we need both array_offset and array_offset_start; can't > both > > SQL functions just call one C function? > > Not if you want the opr_sanity tests to pass. > > (But I'm seriously start

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-10 Thread Robert Haas
On Tue, Mar 10, 2015 at 5:53 PM, Jim Nasby wrote: > I don't think we need both array_offset and array_offset_start; can't both > SQL functions just call one C function? Not if you want the opr_sanity tests to pass. (But I'm seriously starting to wonder if that's actually a smart rule for us to b

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-10 Thread Tom Lane
Jim Nasby writes: > That said, this pattern with fn_extra is repeated a lot, even just in > the backend (not counting contrib or extensions). It would be nice if > there was generic support for this. What do you mean by "generic support"? Most of those functions are doing quite different thing

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-10 Thread Jim Nasby
On 3/10/15 2:43 PM, Pavel Stehule wrote: There is not all that much commonality; many functions don't bother to populate all of the ArrayMetaState fields because they don't need all of them. (The ones you quote don't, in fact.) You are either going to end up with a subroutine t

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-10 Thread Jim Nasby
On 2/22/15 5:19 AM, Pavel Stehule wrote: 2015-02-22 3:00 GMT+01:00 Petr Jelinek mailto:p...@2ndquadrant.com>>: On 28/01/15 08:15, Pavel Stehule wrote: 2015-01-28 0:01 GMT+01:00 Jim Nasby mailto:jim.na...@bluetreble.com>

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-10 Thread Jim Nasby
On 3/10/15 10:53 AM, Jim Nasby wrote: On 3/10/15 9:30 AM, Robert Haas wrote: On Sat, Mar 7, 2015 at 1:06 PM, Petr Jelinek wrote: You still duplicate the type cache code, but many other array functions do that too so I will not hold that against you. (Maybe somebody should write separate patch

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-10 Thread Robert Haas
On Tue, Mar 10, 2015 at 3:43 PM, Pavel Stehule wrote: > I have not good feeling about it too. If we would to enhance this are, we > probably need a specific flinfo field and flags to specify more precious the > context of cached informations. my_extra should be reserved for generic > usage. But st

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-10 Thread Pavel Stehule
2015-03-10 19:50 GMT+01:00 Tom Lane : > Pavel Stehule writes: > > 2015-03-10 15:30 GMT+01:00 Robert Haas : > >> I am sure in agreement with the idea that it would be good to factor > >> out the common typecache code (for setting up my_extra). Any chance > >> we get a preliminary patch that does

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-10 Thread Tom Lane
Pavel Stehule writes: > 2015-03-10 15:30 GMT+01:00 Robert Haas : >> I am sure in agreement with the idea that it would be good to factor >> out the common typecache code (for setting up my_extra). Any chance >> we get a preliminary patch that does that refactoring, and then rebase >> the main pat

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-10 Thread Pavel Stehule
2015-03-10 15:30 GMT+01:00 Robert Haas : > On Sat, Mar 7, 2015 at 1:06 PM, Petr Jelinek wrote: > > You still duplicate the type cache code, but many other array functions > do > > that too so I will not hold that against you. (Maybe somebody should > write > > separate patch that would put all th

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-10 Thread Robert Haas
On Sat, Mar 7, 2015 at 1:06 PM, Petr Jelinek wrote: > You still duplicate the type cache code, but many other array functions do > that too so I will not hold that against you. (Maybe somebody should write > separate patch that would put all that duplicate code into common function?) > > I think t

Re: [HACKERS] proposal: searching in array function - array_position

2015-03-07 Thread Petr Jelinek
On 22/02/15 12:19, Pavel Stehule wrote: 2015-02-22 3:00 GMT+01:00 Petr Jelinek mailto:p...@2ndquadrant.com>>: On 28/01/15 08:15, Pavel Stehule wrote: 2015-01-28 0:01 GMT+01:00 Jim Nasby mailto:jim.na...@bluetreble.com>>>: On 1/27/15 4:36 AM, Pavel Stehule wrote:

Re: [HACKERS] proposal: searching in array function - array_position

2015-02-22 Thread Pavel Stehule
2015-02-22 3:00 GMT+01:00 Petr Jelinek : > On 28/01/15 08:15, Pavel Stehule wrote: > >> >> >> 2015-01-28 0:01 GMT+01:00 Jim Nasby > >: >> >> On 1/27/15 4:36 AM, Pavel Stehule wrote: >> >> >> It is only partially identical - I would to use cache for >>

Re: [HACKERS] proposal: searching in array function - array_position

2015-02-21 Thread Petr Jelinek
On 28/01/15 08:15, Pavel Stehule wrote: 2015-01-28 0:01 GMT+01:00 Jim Nasby mailto:jim.na...@bluetreble.com>>: On 1/27/15 4:36 AM, Pavel Stehule wrote: It is only partially identical - I would to use cache for array_offset, but it is not necessary for array_offsets ..

Re: [HACKERS] proposal: searching in array function - array_position

2015-01-27 Thread Pavel Stehule
2015-01-28 0:01 GMT+01:00 Jim Nasby : > On 1/27/15 4:36 AM, Pavel Stehule wrote: > >> 2015-01-26 23:29 GMT+01:00 Jim Nasby > jim.na...@bluetreble.com>>: >> >> On 1/26/15 4:17 PM, Pavel Stehule wrote: >> >> Any way to reduce the code duplication between the array and >> non-array v

Re: [HACKERS] proposal: searching in array function - array_position

2015-01-27 Thread Jim Nasby
On 1/27/15 4:36 AM, Pavel Stehule wrote: 2015-01-26 23:29 GMT+01:00 Jim Nasby mailto:jim.na...@bluetreble.com>>: On 1/26/15 4:17 PM, Pavel Stehule wrote: Any way to reduce the code duplication between the array and non-array versions? Maybe factor out the operator caching code

Re: [HACKERS] proposal: searching in array function - array_position

2015-01-27 Thread Pavel Stehule
2015-01-26 23:29 GMT+01:00 Jim Nasby : > On 1/26/15 4:17 PM, Pavel Stehule wrote: > >> Any way to reduce the code duplication between the array and >> non-array versions? Maybe factor out the operator caching code? >> >> >> I though about it - but there is different checks, different result >>

Re: [HACKERS] proposal: searching in array function - array_position

2015-01-26 Thread Jim Nasby
On 1/26/15 4:17 PM, Pavel Stehule wrote: Any way to reduce the code duplication between the array and non-array versions? Maybe factor out the operator caching code? I though about it - but there is different checks, different result processing, different result type. I didn't find any r

Re: [HACKERS] proposal: searching in array function - array_position

2015-01-26 Thread Pavel Stehule
2015-01-26 23:01 GMT+01:00 Jim Nasby : > On 1/24/15 2:48 AM, Pavel Stehule wrote: > >> with array_offsets - returns a array of offsets >> > > + returns a offset of first occurrence of some element in a > array. It uses > should be > + returns the offset of the first occurrence of s

Re: [HACKERS] proposal: searching in array function - array_position

2015-01-26 Thread Jim Nasby
On 1/24/15 2:48 AM, Pavel Stehule wrote: with array_offsets - returns a array of offsets + returns a offset of first occurrence of some element in a array. It uses should be + returns the offset of the first occurrence of some element in an array. It uses + returns a

Re: [HACKERS] proposal: searching in array function - array_position

2015-01-24 Thread Pavel Stehule
Hi with array_offsets - returns a array of offsets Regards Pavel 2015-01-20 21:32 GMT+01:00 Jim Nasby : > On 1/20/15 11:12 AM, Pavel Stehule wrote: > >> I am sending updated version - it allow third optional argument that >> specify where searching should to start. With it is possible repeatab

Re: [HACKERS] proposal: searching in array function - array_position

2015-01-20 Thread Pavel Stehule
2015-01-20 21:32 GMT+01:00 Jim Nasby : > On 1/20/15 11:12 AM, Pavel Stehule wrote: > >> I am sending updated version - it allow third optional argument that >> specify where searching should to start. With it is possible repeatably >> call this function. >> > > What happened to returning an array

Re: [HACKERS] proposal: searching in array function - array_position

2015-01-20 Thread Jim Nasby
On 1/20/15 11:12 AM, Pavel Stehule wrote: I am sending updated version - it allow third optional argument that specify where searching should to start. With it is possible repeatably call this function. What happened to returning an array of offsets? I think that would be both easier to use

Re: [HACKERS] proposal: searching in array function - array_position

2015-01-20 Thread Pavel Stehule
Hi I am sending updated version - it allow third optional argument that specify where searching should to start. With it is possible repeatably call this function. Regards Pavel 2015-01-17 23:43 GMT+01:00 Pavel Stehule : > Hi > > here is a proof concept of array_offset function > > possible qu

Re: [HACKERS] proposal: searching in array function - array_position

2015-01-17 Thread Pavel Stehule
Hi here is a proof concept of array_offset function possible question: * used comparation "=" or "IS NOT DISTINCT FROM" In this initial proof concept I used "IS NOT DISTINCT FROM" operator - but my opinion is not strong in this question. Both has some advantages and disadvantages. Regards Pav

Re: [HACKERS] proposal: searching in array function - array_position

2015-01-17 Thread Pavel Stehule
2015-01-16 17:57 GMT+01:00 Jim Nasby : > On 1/16/15 3:39 AM, Pavel Stehule wrote: > >> I am proposing a simple function, that returns a position of element in >> array. >> > > Yes please! > > FUNCTION array_position(anyarray, anyelement) RETURNS int >> > > That won't work on a multi-dimensional a

Re: [HACKERS] proposal: searching in array function - array_position

2015-01-16 Thread Pavel Stehule
2015-01-16 18:37 GMT+01:00 Jim Nasby : > On 1/16/15 11:16 AM, Pavel Stehule wrote: > >> >> >> 2015-01-16 17:57 GMT+01:00 Jim Nasby > jim.na...@bluetreble.com>>: >> >> On 1/16/15 3:39 AM, Pavel Stehule wrote: >> >> I am proposing a simple function, that returns a position of >> element

Re: [HACKERS] proposal: searching in array function - array_position

2015-01-16 Thread Jim Nasby
On 1/16/15 11:16 AM, Pavel Stehule wrote: 2015-01-16 17:57 GMT+01:00 Jim Nasby mailto:jim.na...@bluetreble.com>>: On 1/16/15 3:39 AM, Pavel Stehule wrote: I am proposing a simple function, that returns a position of element in array. Yes please! FUNCTION array_posi

Re: [HACKERS] proposal: searching in array function - array_position

2015-01-16 Thread Pavel Stehule
2015-01-16 17:57 GMT+01:00 Jim Nasby : > On 1/16/15 3:39 AM, Pavel Stehule wrote: > >> I am proposing a simple function, that returns a position of element in >> array. >> > > Yes please! > > FUNCTION array_position(anyarray, anyelement) RETURNS int >> > > That won't work on a multi-dimensional a

Re: [HACKERS] proposal: searching in array function - array_position

2015-01-16 Thread Jim Nasby
On 1/16/15 3:39 AM, Pavel Stehule wrote: I am proposing a simple function, that returns a position of element in array. Yes please! FUNCTION array_position(anyarray, anyelement) RETURNS int That won't work on a multi-dimensional array. Ideally it needs to accept a slice or an element and r