Re: lag() default value ignored for some window partition depending on table records count? - Mailing list pgsql-bugs

From Loïc Revest
Subject Re: lag() default value ignored for some window partition depending on table records count?
Date
Msg-id CABkOrLsPtG=fgHTuTQz35RMx1jvFJ8NN1Nrvto-b4hQB8hS5oQ@mail.gmail.com
Whole thread Raw
In response to Re: lag() default value ignored for some window partition depending on table records count?  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-bugs
>> On Wed, 27 Apr 2022 at 10:48, David G. Johnston
>> <david.g.johnston@gmail.com> wrote:
>>
>> There can only be qual pushdown when the column in the qual is present
>> in the PARTITION BY clause. In this case, there's no PARTITION BY
>> clause, so can't be pushdowns.
>>
peer_id being only used as a sort criterion instead of the
partitioning factor is indeed the culprit, and a true shame I haven't
figured it out on my own.

lag(<value>, 1, 0::numeric) OVER (PARTITION BY peer_id ORDER BY
calculation_time) returns 0::numeric for first row in partition, as
expected.

Thanks a lot to all three of you for pointing it out to me, and my
apologies for the unrelevant noise on that list.

Regards,
L. Revest



pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: psql emit WARNING if built with option --with-extra-version and the option only contains numbers
Next
From: Masahiko Sawada
Date:
Subject: Re: [issue] wal_buffers_full increases depending on the values of wal_buffers and wal-segsize