pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Gierth <rhodiumtoad@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Selectively include window frames in expression walks/mutates.
Date: Thu, 03 Oct 2019 10:52:52 +0000
Message-ID: <E1iFyj6-0003O2-OD@gemulon.postgresql.org> (raw)

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.c...

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ede0ab6ccce498018e0b2112bcc2748a9799df40

Modified Files
--------------
src/backend/catalog/dependency.c     |   9 +--
src/backend/nodes/nodeFuncs.c        | 105 +++++++++++++++++++++++++++++++++++
src/include/nodes/nodeFuncs.h        |   1 +
src/test/regress/expected/window.out |  42 ++++++++++++++
src/test/regress/sql/window.sql      |  19 +++++++
5 files changed, 169 insertions(+), 7 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1iFyj6-0003O2-OD@gemulon.postgresql.org>
Permalink:  ../E1iFyj6-0003O2-OD@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1iFyj6-0003O2-OD@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: rhodiumtoad@postgresql.org
  Subject: Re: pgsql: Selectively include window frames in expression walks/mutates.
  In-Reply-To: <E1iFyj6-0003O2-OD@gemulon.postgresql.org>
  References: <E1iFyj6-0003O2-OD@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox