]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix multi WinGetFuncArgInFrame/Partition calls with IGNORE NULLS.
authorTatsuo Ishii <ishii@postgresql.org>
Wed, 22 Oct 2025 03:06:33 +0000 (12:06 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Wed, 22 Oct 2025 03:06:33 +0000 (12:06 +0900)
commit2d7b247cb414ccbc052c485fd82a841477a7e1ff
tree1302da4dfb170ed1ba4cb2ddfe0d9e9c088556d5
parent883a95646a8e67a2d316f230712ed82b8ba58e28
Fix multi WinGetFuncArgInFrame/Partition calls with IGNORE NULLS.

Previously it was mistakenly assumed that there's only one window
function argument which needs to be processed by WinGetFuncArgInFrame
or WinGetFuncArgInPartition when IGNORE NULLS option is specified. To
eliminate the limitation, WindowObject->notnull_info is modified from
"uint8 *" to "uint8 **" so that WindowObject->notnull_info could store
pointers to "uint8 *" which holds NOT NULL info corresponding to each
window function argument. Moreover, WindowObject->num_notnull_info is
changed from "int" to "int64 *" so that WindowObject->num_notnull_info
could store the number of NOT NULL info corresponding to each function
argument. Memories for these data structures will be allocated when
WinGetFuncArgInFrame or WinGetFuncArgInPartition is called. Thus no
memory except the pointers is allocated for function arguments which
do not call these functions

Also fix the set mark position logic in WinGetFuncArgInPartition to
not raise a "cannot fetch row before WindowObject's mark position"
error in IGNORE NULLS case.

Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Author: Tatsuo Ishii <ishii@postgresql.org>
Discussion: https://postgr.es/m/2952409.1760023154%40sss.pgh.pa.us
src/backend/executor/nodeWindowAgg.c