Re: Query Regarding frame options initialization in Window aggregate state

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vallimaharajan G <vallimaharajan(dot)gs(at)zohocorp(dot)com>
Cc: "pgsql-hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Query Regarding frame options initialization in Window aggregate state
Date: 2024-03-27 16:56:48
Message-ID: 3320047.1711558608@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Vallimaharajan G <vallimaharajan(dot)gs(at)zohocorp(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Sabino Mullane 2024-03-27 17:05:08 Re: Possibility to disable `ALTER SYSTEM`
Previous Message Ranier Vilela 2024-03-27 16:47:38 Re: Slow GRANT ROLE on PostgreSQL 16 with thousands of ROLEs