Re: Query Regarding frame options initialization in Window aggregate state
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Vallimaharajan G <vallimaharajan.gs@zohocorp.com>
Cc: "pgsql-hackers" <pgsql-hackers@postgresql.org>
Date: 2024-03-27T16:56:48Z
Lists: pgsql-hackers
Vallimaharajan G <vallimaharajan.gs@zohocorp.com> writes: > I am currently referring to the Postgres source code (psql (PostgreSQL) 14.3) and came across a particular section related to window aggregate initialization that has left me with a question. Specifically, I noticed a conditional case in the initialization of per aggregate (initialize_peraggregate in nodeWindowAgg.c) where the winstate frameOptions is being checked, but it appears that frameOptions is not set before this conditional case. You are right, and that's a bug. It's not of major consequence --- it would just cause us to set up for moving-aggregate mode when we won't ever actually move the frame head -- but it's at least a little bit inefficient. While I'm looking at it, there's a pretty obvious typo in the adjacent comment: - * and collect the right set of fields from the pg_attribute entry. + * and collect the right set of fields from the pg_aggregate entry. regards, tom lane
Commits
-
Fix unnecessary use of moving-aggregate mode with non-moving frame.
- de3c5b18729a 13.15 landed
- a94f51a7bfc9 16.3 landed
- a767cdc84c9a 17.0 landed
- 25675c474292 12.19 landed
- 0d30e48c2578 14.12 landed
- 03561a6c7bbf 15.7 landed