diff options
| author | Tom Lane | 2012-08-12 20:01:26 +0000 |
|---|---|---|
| committer | Tom Lane | 2012-08-12 20:01:26 +0000 |
| commit | c1774d2c8193a322706f681dd984ac439d3a9dbb (patch) | |
| tree | 85fd93fd7dfd6c71bd7236d2dba573fb9f4c51b6 /src/include/optimizer | |
| parent | e76af54137c051cafcb1e39f68383a31d1d55ff6 (diff) | |
More fixes for planner's handling of LATERAL.
Re-allow subquery pullup for LATERAL subqueries, except when the subquery
is below an outer join and contains lateral references to relations outside
that outer join. If we pull up in such a case, we risk introducing lateral
cross-references into outer joins' ON quals, which is something the code is
entirely unprepared to cope with right now; and I'm not sure it'll ever be
worth coping with.
Support lateral refs in VALUES (this seems to be the only additional path
type that needs such support as a consequence of re-allowing subquery
pullup).
Put in a slightly hacky fix for joinpath.c's refusal to consider
parameterized join paths even when there cannot be any unparameterized
ones. This was causing "could not devise a query plan for the given query"
failures in queries involving more than two FROM items.
Put in an even more hacky fix for distribute_qual_to_rels() being unhappy
with join quals that contain references to rels outside their syntactic
scope; which is to say, disable that test altogether. Need to think about
how to preserve some sort of debugging cross-check here, while not
expending more cycles than befits a debugging cross-check.
Diffstat (limited to 'src/include/optimizer')
| -rw-r--r-- | src/include/optimizer/cost.h | 2 | ||||
| -rw-r--r-- | src/include/optimizer/pathnode.h | 3 | ||||
| -rw-r--r-- | src/include/optimizer/prep.h | 4 |
3 files changed, 4 insertions, 5 deletions
diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h index e3d33d69ba3..7f6870e5f08 100644 --- a/src/include/optimizer/cost.h +++ b/src/include/optimizer/cost.h @@ -83,7 +83,7 @@ extern void cost_subqueryscan(Path *path, PlannerInfo *root, extern void cost_functionscan(Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info); extern void cost_valuesscan(Path *path, PlannerInfo *root, - RelOptInfo *baserel); + RelOptInfo *baserel, ParamPathInfo *param_info); extern void cost_ctescan(Path *path, PlannerInfo *root, RelOptInfo *baserel); extern void cost_recursive_union(Plan *runion, Plan *nrterm, Plan *rterm); extern void cost_sort(Path *path, PlannerInfo *root, diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h index 3af1172cbe5..33f2bf13c09 100644 --- a/src/include/optimizer/pathnode.h +++ b/src/include/optimizer/pathnode.h @@ -71,7 +71,8 @@ extern Path *create_subqueryscan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer); extern Path *create_functionscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer); -extern Path *create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel); +extern Path *create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel, + Relids required_outer); extern Path *create_ctescan_path(PlannerInfo *root, RelOptInfo *rel); extern Path *create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel); extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel, diff --git a/src/include/optimizer/prep.h b/src/include/optimizer/prep.h index 47a27b66e8a..20f677f97c2 100644 --- a/src/include/optimizer/prep.h +++ b/src/include/optimizer/prep.h @@ -23,9 +23,7 @@ */ extern void pull_up_sublinks(PlannerInfo *root); extern void inline_set_returning_functions(PlannerInfo *root); -extern Node *pull_up_subqueries(PlannerInfo *root, Node *jtnode, - JoinExpr *lowest_outer_join, - AppendRelInfo *containing_appendrel); +extern Node *pull_up_subqueries(PlannerInfo *root, Node *jtnode); extern void flatten_simple_union_all(PlannerInfo *root); extern void reduce_outer_joins(PlannerInfo *root); extern Relids get_relids_in_jointree(Node *jtnode, bool include_joins); |
