Re: Add RANGE with values and exclusions clauses to the Window Functions - Mailing list pgsql-hackers

From Oliver Ford
Subject Re: Add RANGE with values and exclusions clauses to the Window Functions
Date
Msg-id CAGMVOdtGe=30u6D2WqwvWchE+-yNb9jKnEeG8BHyw7jHiGPR7w@mail.gmail.com
Whole thread Raw
In response to Re: Add RANGE with values and exclusions clauses to the WindowFunctions  (Erik Rijkers <er@xs4all.nl>)
Responses Re: Add RANGE with values and exclusions clauses to the WindowFunctions
Re: Add RANGE with values and exclusions clauses to the Window Functions
List pgsql-hackers
On Sat, Jan 27, 2018 at 7:40 AM, Erik Rijkers <er@xs4all.nl> wrote:
> On 2018-01-27 00:35, Oliver Ford wrote:
>>
>> Attached patch implements an extensible version of the RANGE with
>> values clause. It doesn't actually add any more type support than was
>
> [...]
>>
>> I've tested that the existing regression tests in previous versions
>> still pass, and also added new tests for descending mode.
>>
>> [0001-window-frame-v7.patch]
>
>
> Hi,
>
> Regression tests only succeed for assert-disabled compiles; they fail when
> assert-enabled:
>
> I used (Centos 6.9):

Could you please try the attached version? It works for me with asserts enabled.

Problem seems to be with an existing Assert in catcache.c:1545:

Assert(nkeys > 0 && nkeys < cache->cc_nkeys);

The "<" needs to be "<=" (and is changed in the attached patch).
AFAICT this was never a problem before purely because no code before
this patch called SearchSysCacheList4, so they always called with
fewer keys than the number available. But it's surely correct to
assert that the number of keys supplied is less than or equal to, not
less than, the number of keys in the cache.

Attachment

pgsql-hackers by date:

Previous
From: Ildar Musin
Date:
Subject: Re: General purpose hashing func in pgbench
Next
From: Erik Rijkers
Date:
Subject: Re: Add RANGE with values and exclusions clauses to the WindowFunctions