pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Repair breakage of aggregate FILTER option.
Date: Mon, 16 Oct 2017 19:24:49 +0000
Message-ID: <E1e4B0L-0002yo-TT@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Repair breakage of aggregate FILTER option.

An aggregate's input expression(s) are not supposed to be evaluated
at all for a row where its FILTER test fails ... but commit 8ed3f11bb
overlooked that requirement.  Reshuffle so that aggregates having a
filter clause evaluate their arguments separately from those without.
This still gets the benefit of doing only one ExecProject in the
common case of multiple Aggrefs, none of which have filters.

While at it, arrange for filter clauses to be included in the common
ExecProject evaluation, thus perhaps buying a little bit even when
there are filters.

Back-patch to v10 where the bug was introduced.

Discussion: https://postgr.es/m/30065.1508161354@sss.pgh.pa.us

Branch
------
master

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

Modified Files
--------------
src/backend/executor/nodeAgg.c           | 186 ++++++++++++++++++++-----------
src/include/nodes/execnodes.h            |   6 +-
src/test/regress/expected/aggregates.out |   6 +
src/test/regress/sql/aggregates.sql      |   2 +
4 files changed, 130 insertions(+), 70 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (2+ messages)  latest in thread

Message-ID: <E1e4B0L-0002yo-TT@gemulon.postgresql.org>
Permalink:  ../E1e4B0L-0002yo-TT@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1e4B0L-0002yo-TT@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Repair breakage of aggregate FILTER option.
  In-Reply-To: <E1e4B0L-0002yo-TT@gemulon.postgresql.org>
  References: <E1e4B0L-0002yo-TT@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