Re: Analytic Function Bug

From: Rumpi Gravenstein <rgravens(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Analytic Function Bug
Date: 2024-08-30 11:55:40
Message-ID: CAEpg1wADBGuz1ej9WQ=0Ci5=RCv=-z8WT6KYG7ssR_roYy9FOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Wait...I see my issue. Duh! The where clause is applied after the CTE is
evaluated

On Fri, Aug 30, 2024 at 7:37 AM Rumpi Gravenstein <rgravens(at)gmail(dot)com>
wrote:

> <snip>
> that the lag() functions are seeing some rows that don't show up in
> the final output.
> </snip>
>
> I'm under the impression that the predicate filter is applied before the
> analytic is evaluated. Are you suggesting that I have this wrong -- the
> analytic is evaluated and then the filter is applied?
>
> On Thu, Aug 29, 2024 at 8:07 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> Rumpi Gravenstein <rgravens(at)gmail(dot)com> writes:
>> > Is this a PostgreSQL bug?
>>
>> Maybe, but you haven't provided enough information to let anyone else
>> reproduce the behavior.
>>
>> Personally I'm suspicious that because your lag() calls are over
>>
>> partition by p.logical_partition_key, p.txt order by indx
>>
>> but then you filter by
>>
>> where logical_partition_key='TEST_DATA' and
>> usage_text='F(T61)(EXPORT)';
>>
>> that the lag() functions are seeing some rows that don't show up in
>> the final output. (This'd require that some output rows from "parse"
>> share txt values but not usage_text values, but that certainly looks
>> like it's possible.) So IMO you have not actually demonstrated that
>> there is any bug.
>>
>> regards, tom lane
>>
>
>
> --
> Rumpi Gravenstein
>

--
Rumpi Gravenstein

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Sabino Mullane 2024-08-30 12:45:56 Re: PgBackRest full backup first time : Verification
Previous Message Rumpi Gravenstein 2024-08-30 11:45:29 Re: Analytic Function Bug