]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Refine error reporting for null treatment on non-window functions
authorFujii Masao <fujii@postgresql.org>
Wed, 24 Jun 2026 02:42:36 +0000 (11:42 +0900)
committerFujii Masao <fujii@postgresql.org>
Wed, 24 Jun 2026 02:42:36 +0000 (11:42 +0900)
commit419ce13b7019f906ebc010af3be09a9deffc2a47
treef80216fa3e7ee2df35fd8219a4834645dac438ac
parent4015abe14bb05f67d2c47549f59c5d382e57150b
Refine error reporting for null treatment on non-window functions

Commit 4e5920e6de8 disallowed RESPECT NULLS/IGNORE NULLS on
non-window functions, but it also caused the parser to check for
that clause too early in some cases. As a result, calls such as a
nonexistent function with IGNORE NULLS no longer reported the more
helpful "function ... does not exist" error, and aggregate functions
used as window functions reported "only window functions accept ..."
instead of the more accurate aggregate-specific error.

This commit moves the RESPECT NULLS/IGNORE NULLS checks so that
helpful existing errors are preserved where appropriate. This restores
"function ... does not exist" for nonexistent functions, while still
reporting that plain functions are not window functions and that
aggregates do not accept null treatment.

Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CAHGQGwH7VY_0GkhycyYZ4czkPGL0uGzDyOxk3uuFOSRR7wFY3g@mail.gmail.com
src/backend/parser/parse_func.c
src/test/regress/expected/window.out
src/test/regress/sql/window.sql