Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sjzwa-006WvZ-9r for pgsql-general@arkaria.postgresql.org; Fri, 30 Aug 2024 11:37:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sjzwY-002XJW-FO for pgsql-general@arkaria.postgresql.org; Fri, 30 Aug 2024 11:37:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sjzwY-002XIP-46 for pgsql-general@lists.postgresql.org; Fri, 30 Aug 2024 11:37:30 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sjzwV-002F4x-9G for pgsql-general@lists.postgresql.org; Fri, 30 Aug 2024 11:37:30 +0000 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2f50966c469so19328901fa.3 for ; Fri, 30 Aug 2024 04:37:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725017847; x=1725622647; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=sJby15szL3SDIFmex/sGBmjYpV0Wyzu0+uI9jhzrNno=; b=Iro0oaRFeNCnP9ewiL8mVOixyZHJ27QBY9JlEG4HGf98Y7KNNPP1C58igTVIofR0WX Scn+SyPZTBNVUWpF3IXNnmjhNt6GRG10Oj6o9AqXfWuXNfQqNp0za1JBFDpLXBocU4RK IPQhyyhBbiMkaOfMBZ8POEGivxIkLL6DkoSZjBGIoRxRWUrcDTzpvxbUSiRA1UOOUNOT JXGKUh+7tPjagCK4lUU4RHkNFC1LHmnmw/AyvBL68DLARw2kl9dp0+If4GJ57R0VVmXy +K6xmqiUgQFehhUTdHteo6qaTcDvdRYwnimX8gMx3PL5wrwKklO6thmpOtkoNhx9xHrE SV2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725017847; x=1725622647; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sJby15szL3SDIFmex/sGBmjYpV0Wyzu0+uI9jhzrNno=; b=pwrtfh79FruyqPaM2cDvQscYNzQ8Cm+HXUGEVTQEGjQRcGCh2b1Or/wIRV3RRoUkes /p0UZyrkrwFKfoK3I1/4HWQBUT+P0hnCHfMDF2C1XLFxatX3XF4okn7b92Wu1TeCWYhm 25ivCHFgNukTS2Mrs690X6/YAlX8v5jfrVJU5mJpEaXYUwRvP6DJBITistvPpk6SG5b1 flCYNZeXCUQuu2CBSdq+FKVNVh3oic3wA1K+cTe30fcB9qDDL3T9AA/yjw/PF2EjwOz0 8GPbkhWaAGZ6W3CU1mE+QYFc7tUTfqS61DcBk6eWL38/h1ryVh/4ujAxj+AnDYBCxFfQ OJOw== X-Forwarded-Encrypted: i=1; AJvYcCUIU5NbDSa6aMJM0NLre1CwsMcl3T8QytHhBlC6B1j4PthQHoTqSGvTsn5pHjZ9Iwjmfw2QTm5X8h8HWgfm@lists.postgresql.org X-Gm-Message-State: AOJu0YyE8vcQbx8PDa1lCJMLYepyeQe4qTb8E8RmsZTfI3Gwexa16nGV 5gWWAGhWj8GzHs6qa/J47K+5HzkQNMbhTuacl3qHfUi93T8Ju3PDo4DR1mkaVowA1lTpQUeKsN+ t6nQAgdfPsMPSbBrICeSbOVgcCyo= X-Google-Smtp-Source: AGHT+IGxui4twhnnaRnpL7D3zIvW8EN9zfSDccqNnYL3S45b1QLfIMx6Cj8vn+VilxeFW10r4Fqh/L8HrSwMWxgFj8c= X-Received: by 2002:a05:651c:2222:b0:2ec:568e:336e with SMTP id 38308e7fff4ca-2f6103924d0mr48077931fa.1.1725017846575; Fri, 30 Aug 2024 04:37:26 -0700 (PDT) MIME-Version: 1.0 References: <317220.1724976433@sss.pgh.pa.us> In-Reply-To: <317220.1724976433@sss.pgh.pa.us> From: Rumpi Gravenstein Date: Fri, 30 Aug 2024 07:37:15 -0400 Message-ID: Subject: Re: Analytic Function Bug To: Tom Lane , PostgreSQL Content-Type: multipart/alternative; boundary="000000000000f9ff700620e5037f" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000f9ff700620e5037f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable that the lag() functions are seeing some rows that don't show up in the final output. 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=E2=80=AFPM Tom Lane wrote: > Rumpi Gravenstein 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=3D'TEST_DATA' and > usage_text=3D'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 > --=20 Rumpi Gravenstein --000000000000f9ff700620e5037f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
<snip>
that the lag() functions are s= eeing some rows that don't show up in
the final output.=C2=A0=C2=A0<= br>
</snip>

I'm under the impression that the predicate filter is applied before = the analytic is evaluated.=C2=A0 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=E2=80=AFPM Tom Lane <= tgl@sss.pgh.pa.us> wrote:
Rumpi Gravenstein <rgravens@gmail.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

=C2=A0 =C2=A0 partition by p.logical_partition_key, p.txt order by indx

but then you filter by

=C2=A0 =C2=A0 where logical_partition_key=3D'TEST_DATA' and usage_t= ext=3D'F(T61)(EXPORT)';

that the lag() functions are seeing some rows that don't show up in
the final output.=C2=A0 (This'd require that some output rows from &quo= t;parse"
share txt values but not usage_text values, but that certainly looks
like it's possible.)=C2=A0 So IMO you have not actually demonstrated th= at
there is any bug.

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 regards, tom lane


--
Ru= mpi Gravenstein
--000000000000f9ff700620e5037f--