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@lists.postgresql.org
Subject: pgsql: Fix mishandling of sortgroupref labels while splitting SRF targe
Date: Thu, 21 Jun 2018 14:58:55 +0000
Message-ID: <E1fW131-0006AW-Gt@gemulon.postgresql.org> (raw)

Fix mishandling of sortgroupref labels while splitting SRF targetlists.

split_pathtarget_at_srfs() neglected to worry about sortgroupref labels
in the intermediate PathTargets it constructs.  I think we'd supposed
that their labeling didn't matter, but it does at least for the case that
GroupAggregate/GatherMerge nodes appear immediately under the ProjectSet
step(s).  This results in "ERROR: ORDER/GROUP BY expression not found in
targetlist" during create_plan(), as reported by Rajkumar Raghuwanshi.

To fix, make this logic track the sortgroupref labeling of expressions,
not just their contents.  This also restores the pre-v10 behavior that
separate GROUP BY expressions will be kept distinct even if they are
textually equal().

Discussion: https://postgr.es/m/CAKcux6=1_Ye9kx8YLBPmJs_xE72PPc6vNi5q2AOHowMaCWjJ2w@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/07e5a213524853c06684155d4af5a0291d95d25a

Modified Files
--------------
src/backend/optimizer/util/tlist.c            | 146 +++++++++++++++++++++++---
src/test/regress/expected/select_parallel.out |  62 +++++++++++
src/test/regress/sql/select_parallel.sql      |   7 ++
3 files changed, 198 insertions(+), 17 deletions(-)



view thread (2+ messages)

Message-ID: <E1fW131-0006AW-Gt@gemulon.postgresql.org>
Permalink:  ../E1fW131-0006AW-Gt@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1fW131-0006AW-Gt@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: Fix mishandling of sortgroupref labels while splitting SRF targe
  In-Reply-To: <E1fW131-0006AW-Gt@gemulon.postgresql.org>
  References: <E1fW131-0006AW-Gt@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