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: Fix get_useful_pathkeys_for_relation for volatile expressions
Date: Tue, 03 Nov 2020 21:33:01 +0000
Message-ID: <E1ka3vJ-0006DC-MO@gemulon.postgresql.org> (raw)

Fix get_useful_pathkeys_for_relation for volatile expressions

When considering Incremental Sort below a Gather Merge, we need to be
a bit more careful when matching pathkeys to EC members. It's not enough
to find a member whose Vars are all in the current relation's target;
volatile expressions in particular need to be contained in the target,
otherwise it's too early to use the pathkey.

Reported-by: Jaime Casanova
Author: James Coleman
Reviewed-by: Tomas Vondra
Backpatch-through: 13, where the incremental sort code was added
Discussion: https://postgr.es/m/CAJGNTeNaxpXgBVcRhJX%2B2vSbq%2BF2kJqGBcvompmpvXb7pq%2BoFA%40mail.gmail.com

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2d26c4ac703447a002a02124c1edd01e70a5d1ee

Modified Files
--------------
src/backend/optimizer/path/allpaths.c          | 13 ++--
src/backend/optimizer/path/equivclass.c        | 70 ++++++++++++++++++
src/include/optimizer/paths.h                  |  1 +
src/test/regress/expected/incremental_sort.out | 98 ++++++++++++++++++++++++++
src/test/regress/sql/incremental_sort.sql      | 31 ++++++++
5 files changed, 207 insertions(+), 6 deletions(-)



view thread (2+ messages)

Message-ID: <E1ka3vJ-0006DC-MO@gemulon.postgresql.org>
Permalink:  ../E1ka3vJ-0006DC-MO@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ka3vJ-0006DC-MO@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: Fix get_useful_pathkeys_for_relation for volatile expressions
  In-Reply-To: <E1ka3vJ-0006DC-MO@gemulon.postgresql.org>
  References: <E1ka3vJ-0006DC-MO@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