Re: FETCH FIRST clause PERCENT option - Mailing list pgsql-hackers

From Erik Rijkers
Subject Re: FETCH FIRST clause PERCENT option
Date
Msg-id 4855d0904a110970e88a662df3c768f4@xs4all.nl
Whole thread Raw
In response to Re: FETCH FIRST clause PERCENT option  (Surafel Temesgen <surafel3000@gmail.com>)
Responses Re: FETCH FIRST clause PERCENT option
List pgsql-hackers
On 2018-08-28 14:14, Surafel Temesgen wrote:
> On Tue, Aug 21, 2018 at 3:50 PM Andres Freund <andres@anarazel.de> 
> wrote:
> 
>> 
>> Imagine volatile functions being used. That can be problematic because
>> of repeated side-effects, but also will lead to plainly wrong
>> results. Consider what happens with your approach where somebody does
>> something like WHERE value < random().
>> 
> Thanks for explaining . The attach patch use tuplestore instead

> [fetch-wth-percent-v2.patch]

I had a quick look at this.  Apply, compile, make check are ok.

In straightforward usage seems to work ok.


But I also ran across this crash:

create table if not exists t as
    select i from generate_series(1, 100) as f(i);

select * from t
   offset 60 rows
   fetch next 3 percent rows only
   FOR UPDATE
;

TRAP: FailedAssertion("!(slot != ((void *)0))", File: "execTuples.c", 
Line: 428)




Erik Rijkers




















pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Something's busted in plpgsql composite-variable handling
Next
From: Christoph Berg
Date:
Subject: Re: logical decoding: ABI break in 10.5 et al