]> granicus.if.org Git - postgresql/commit
Selectively include window frames in expression walks/mutates.
authorAndrew Gierth <rhodiumtoad@postgresql.org>
Thu, 3 Oct 2019 09:54:52 +0000 (10:54 +0100)
committerAndrew Gierth <rhodiumtoad@postgresql.org>
Thu, 3 Oct 2019 10:12:39 +0000 (11:12 +0100)
commit0b11dc01922b0f6376a27f84a34a52451e8f476c
tree55b27e068c9cff4f1c3cb996d574c20004ff946c
parent2a724cdbff0bef4b962255c1e322b4deb74c309e
Selectively include window frames in expression walks/mutates.

query_tree_walker and query_tree_mutator were skipping the
windowClause of the query, without regard for the fact that the
startOffset and endOffset in a WindowClause node are expression trees
that need to be processed. This was an oversight in commit ec4be2ee6
from 2010 which added the expression fields; the main symptom is that
function parameters in window frame clauses don't work in inlined
functions.

Fix (as conservatively as possible since this needs to not break
existing out-of-tree callers) and add tests.

Backpatch all the way, since this has been broken since 9.0.

Per report from Alastair McKinley; fix by me with kibitzing and review
from Tom Lane.

Discussion: https://postgr.es/m/DB6PR0202MB2904E7FDDA9D81504D1E8C68E3800@DB6PR0202MB2904.eurprd02.prod.outlook.com
src/backend/catalog/dependency.c
src/backend/nodes/nodeFuncs.c
src/include/nodes/nodeFuncs.h
src/test/regress/expected/window.out
src/test/regress/sql/window.sql