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 5500B02C.5070406@BlueTreble.com
Whole thread Raw
In response to Re: proposal: searching in array function - array_position  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: proposal: searching in array function - array_position  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
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 similar, but it expect large **sorted** input. array_offset
> works on unsorted (alphabetical unsorted) data sets - like days of week ..

The functions are serving rather different purposes, so I'm not sure 
it's worth mentioning. If we do want to mention it, then something like 
the following should be added to *both* functions:
 * This code is similar to width_bucket()

and
 * This code is similar to array_offset()

Incidentally, isn't it bad that we're doing all these static assignments 
inside the loop in width_bucket? Or can we count on the compiler to 
recognize this?

http://lnk.nu/github.com/1dvrr.c
-- 
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Strange assertion using VACOPT_FREEZE in vacuum.c
Next
From: Fabien COELHO
Date:
Subject: Re: improve pgbench syntax error messages