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: Repair logic for reordering grouping sets optimization.
Date: Sun, 30 Jun 2019 22:55:07 +0000
Message-ID: <E1hhiix-0003L8-7G@gemulon.postgresql.org> (raw)

Repair logic for reordering grouping sets optimization.

The logic in reorder_grouping_sets to order grouping set elements to
match a pre-specified sort ordering was defective, resulting in
unnecessary sort nodes (though the query output would still be
correct). Repair, simplifying the code a little, and add a test.

Per report from Richard Guo, though I didn't use their patch. Original
bug seems to have been my fault.

Backpatch back to 9.5 where grouping sets were introduced.

Discussion: https://postgr.es/m/CAN_9JTzyjGcUjiBHxLsgqfk7PkdLGXiM=pwM+=ph2LsWw0WO1A@mail.gmail.com

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4a36c77156f2ff6e07a349cddc65e5dd21abc1a8

Modified Files
--------------
src/backend/optimizer/plan/planner.c       | 39 ++++++++++++++----------------
src/test/regress/expected/groupingsets.out | 13 ++++++++++
src/test/regress/sql/groupingsets.sql      |  3 +++
3 files changed, 34 insertions(+), 21 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1hhiix-0003L8-7G@gemulon.postgresql.org>
Permalink:  ../E1hhiix-0003L8-7G@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1hhiix-0003L8-7G@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: Repair logic for reordering grouping sets optimization.
  In-Reply-To: <E1hhiix-0003L8-7G@gemulon.postgresql.org>
  References: <E1hhiix-0003L8-7G@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