pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Check parallel safety in generate_useful_gather_paths
Date: Mon, 21 Dec 2020 17:57:57 +0000
Message-ID: <E1krPRV-0005Hs-FT@gemulon.postgresql.org> (raw)

Check parallel safety in generate_useful_gather_paths

Commit ebb7ae839d ensured we ignore pathkeys with volatile expressions
when considering adding a sort below a Gather Merge. Turns out we need
to care about parallel safety of the pathkeys too, otherwise we might
try sorting e.g. on results of a correlated subquery (as demonstrated
by a report from Luis Roberto).

Initial investigation by Tom Lane, patch by James Coleman. Backpatch
to 13, where the code was instroduced (as part of Incremental Sort).

Reported-by: Luis Roberto
Author: James Coleman
Reviewed-by: Tomas Vondra
Backpatch-through: 13
Discussion: https://postgr.es/m/622580997.37108180.1604080457319.JavaMail.zimbra%40siscobra.com.br
Discussion: https://postgr.es/m/CAAaqYe8cK3g5CfLC4w7bs=hC0mSksZC=H5M8LSchj5e5OxpTAg@mail.gmail.com

Branch
------
REL_13_STABLE

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

Modified Files
--------------
src/backend/optimizer/path/allpaths.c          | 13 +++++++--
src/backend/optimizer/path/equivclass.c        |  9 +++++-
src/include/optimizer/paths.h                  |  5 +++-
src/test/regress/expected/incremental_sort.out | 40 ++++++++++++++++++++++++++
src/test/regress/sql/incremental_sort.sql      | 11 +++++++
5 files changed, 73 insertions(+), 5 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1krPRV-0005Hs-FT@gemulon.postgresql.org>
Permalink:  ../E1krPRV-0005Hs-FT@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1krPRV-0005Hs-FT@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: tomas.vondra@postgresql.org
  Subject: Re: pgsql: Check parallel safety in generate_useful_gather_paths
  In-Reply-To: <E1krPRV-0005Hs-FT@gemulon.postgresql.org>
  References: <E1krPRV-0005Hs-FT@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