diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-08-17 01:20:00 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-08-17 01:20:00 +0000 |
| commit | 19e34b62395b36513a8e6c35ddfbeef12dd1e89f (patch) | |
| tree | cf74ae45a1d9ea3c6f2ffc471d5dea75fb510984 /src/include/optimizer/subselect.h | |
| parent | 909346eff0ca2c7a73e889122d6f54669494141b (diff) | |
| download | postgresql-19e34b62395b36513a8e6c35ddfbeef12dd1e89f.tar.gz | |
Improve sublink pullup code to handle ANY/EXISTS sublinks that are at top
level of a JOIN/ON clause, not only at top level of WHERE. (However, we
can't do this in an outer join's ON clause, unless the ANY/EXISTS refers
only to the nullable side of the outer join, so that it can effectively
be pushed down into the nullable side.) Per request from Kevin Grittner.
In passing, fix a bug in the initial implementation of EXISTS pullup:
it would Assert if the EXIST's WHERE clause used a join alias variable.
Since we haven't yet flattened join aliases when this transformation
happens, it's necessary to include join relids in the computed set of
RHS relids.
Diffstat (limited to 'src/include/optimizer/subselect.h')
| -rw-r--r-- | src/include/optimizer/subselect.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/include/optimizer/subselect.h b/src/include/optimizer/subselect.h index b9bd76b07f..97e230a2db 100644 --- a/src/include/optimizer/subselect.h +++ b/src/include/optimizer/subselect.h @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/subselect.h,v 1.32 2008/08/14 18:48:00 tgl Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/subselect.h,v 1.33 2008/08/17 01:20:00 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -15,9 +15,13 @@ #include "nodes/plannodes.h" #include "nodes/relation.h" -extern Node *convert_ANY_sublink_to_join(PlannerInfo *root, SubLink *sublink); -extern Node *convert_EXISTS_sublink_to_join(PlannerInfo *root, - SubLink *sublink, bool under_not); +extern bool convert_ANY_sublink_to_join(PlannerInfo *root, SubLink *sublink, + Relids available_rels, + Node **new_qual, List **fromlist); +extern bool convert_EXISTS_sublink_to_join(PlannerInfo *root, SubLink *sublink, + bool under_not, + Relids available_rels, + Node **new_qual, List **fromlist); extern Node *SS_replace_correlation_vars(PlannerInfo *root, Node *expr); extern Node *SS_process_sublinks(PlannerInfo *root, Node *expr, bool isQual); extern void SS_finalize_plan(PlannerInfo *root, Plan *plan, |
