diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2024-03-27 13:39:03 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2024-03-27 13:39:03 -0400 |
commit | 03561a6c7bbfe305b941d46f7bafb3cdd4793982 (patch) | |
tree | f5d4f9d0403b0bbd20a270aacf52d0f7ef77328a /contrib/postgres_fdw/postgres_fdw.c | |
parent | b48eda4e54810aa1d8dd2af7c6763fd414d8e0a1 (diff) | |
download | postgresql-03561a6c7bbfe305b941d46f7bafb3cdd4793982.tar.gz postgresql-03561a6c7bbfe305b941d46f7bafb3cdd4793982.zip |
Fix unnecessary use of moving-aggregate mode with non-moving frame.
When a plain aggregate is used as a window function, and the window
frame start is specified as UNBOUNDED PRECEDING, the frame's head
cannot move so we do not need to use moving-aggregate mode. The check
for that was put into initialize_peragg(), failing to notice that
ExecInitWindowAgg() calls that function before it's filled in
winstate->frameOptions. Since makeNode() would have zeroed the field,
this didn't provoke uninitialized-value complaints, nor would the
erroneous decision have resulted in more than a little inefficiency.
Still, it's wrong, so move the initialization of
winstate->frameOptions earlier to make it work properly.
While here, also fix a thinko in a comment. Both errors crept in in
commit a9d9acbf2 which introduced the moving-aggregate mode.
Spotted by Vallimaharajan G. Back-patch to all supported branches.
Discussion: https://postgr.es/m/18e7f2a5167.fe36253866818.977923893562469143@zohocorp.com
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.c')
0 files changed, 0 insertions, 0 deletions