Re: proposal: searching in array function - array_position

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: searching in array function - array_position
Date: 2015-01-26 22:17:48
Message-ID: CAFj8pRAY6SVOhbaeYoHZUAA73k0Ar2oM=zq9kRDZ7=_guAUYiw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2015-01-26 23:01 GMT+01:00 Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>:

> On 1/24/15 2:48 AM, Pavel Stehule wrote:
>
>> with array_offsets - returns a array of offsets
>>
>
> + <entry>returns a offset of first occurrence of some element in a
> array. It uses
> should be
> + <entry>returns the offset of the first occurrence of some
> element in an array. It uses
>
> + <entry>returns a array of offset of all occurrences some element
> in a array. It uses
> should be
> + <entry>returns an array of the offsets of all occurrences of
> some element in an array. It uses
>
> 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 readable and reduced form :(

> You should remove the array_length() from the last array_offsets test; I
> don't see that it buys anything.
>

ok

>
> I think there should be tests for what happens when you feed these
> functions a multi-dimensional array.
>

I can do it. Result should be expected - it searching row by row due MD
format

>
> Other than that, looks good.

Thank you

Pavel

>
> --
> Jim Nasby, Data Architect, Blue Treble Consulting
> Data in Trouble? Get it in Treble! http://BlueTreble.com
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2015-01-26 22:21:35 Re: pgaudit - an auditing extension for PostgreSQL
Previous Message Robert Haas 2015-01-26 22:11:32 Re: New CF app deployment