summaryrefslogtreecommitdiff
path: root/src/include/optimizer/paths.h
diff options
context:
space:
mode:
authorTomas Vondra <tomas.vondra@postgresql.org>2020-12-21 18:29:46 +0100
committerTomas Vondra <tomas.vondra@postgresql.org>2020-12-21 18:29:49 +0100
commit86b7cca72d4d0a4e043fac0a2cdd56218ff2f258 (patch)
tree43acee2bc25e67f25883383674bd78f64c6f004e /src/include/optimizer/paths.h
parentf4a3c0b06250ddc8ae09b59b87cf68e9bc0d7ca1 (diff)
downloadpostgresql-86b7cca72d4d0a4e043fac0a2cdd56218ff2f258.tar.gz
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
Diffstat (limited to 'src/include/optimizer/paths.h')
-rw-r--r--src/include/optimizer/paths.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h
index 8a4c6f8b59..bf6c16b804 100644
--- a/src/include/optimizer/paths.h
+++ b/src/include/optimizer/paths.h
@@ -135,7 +135,10 @@ 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 Expr *find_em_expr_usable_for_sorting_rel(PlannerInfo *root,
+ EquivalenceClass *ec,
+ RelOptInfo *rel,
+ bool require_parallel_safe);
extern void generate_base_implied_equalities(PlannerInfo *root);
extern List *generate_join_implied_equalities(PlannerInfo *root,
Relids join_relids,