diff options
author | Tomas Vondra <tomas.vondra@postgresql.org> | 2020-11-03 20:07:23 +0100 |
---|---|---|
committer | Tomas Vondra <tomas.vondra@postgresql.org> | 2020-11-03 22:32:34 +0100 |
commit | 2d26c4ac703447a002a02124c1edd01e70a5d1ee (patch) | |
tree | eadbb37000a13cca7882537af987c5b23ffc37e6 /src/include/optimizer/paths.h | |
parent | 936043c9eacb9e9c7356a8190a410d2c4e4ea03a (diff) | |
download | postgresql-2d26c4ac703447a002a02124c1edd01e70a5d1ee.tar.gz postgresql-2d26c4ac703447a002a02124c1edd01e70a5d1ee.zip |
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
Diffstat (limited to 'src/include/optimizer/paths.h')
-rw-r--r-- | src/include/optimizer/paths.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h index 10b6e810796..d72b3a5d42d 100644 --- a/src/include/optimizer/paths.h +++ b/src/include/optimizer/paths.h @@ -135,6 +135,7 @@ extern EquivalenceClass *get_eclass_for_sort_expr(PlannerInfo *root, Relids rel, bool create_it); extern Expr *find_em_expr_for_rel(EquivalenceClass *ec, RelOptInfo *rel); +extern Expr *find_em_expr_usable_for_sorting_rel(EquivalenceClass *ec, RelOptInfo *rel); extern void generate_base_implied_equalities(PlannerInfo *root); extern List *generate_join_implied_equalities(PlannerInfo *root, Relids join_relids, |