From 19e34b62395b36513a8e6c35ddfbeef12dd1e89f Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 17 Aug 2008 01:20:00 +0000 Subject: 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. --- src/include/optimizer/prep.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/include/optimizer/prep.h') diff --git a/src/include/optimizer/prep.h b/src/include/optimizer/prep.h index 1a90a13208..9326623b91 100644 --- a/src/include/optimizer/prep.h +++ b/src/include/optimizer/prep.h @@ -7,7 +7,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/prep.h,v 1.61 2008/08/14 18:48:00 tgl Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/prep.h,v 1.62 2008/08/17 01:20:00 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -21,12 +21,12 @@ /* * prototypes for prepjointree.c */ -extern Node *pull_up_sublinks(PlannerInfo *root, Node *node); +extern void pull_up_sublinks(PlannerInfo *root); extern void inline_set_returning_functions(PlannerInfo *root); extern Node *pull_up_subqueries(PlannerInfo *root, Node *jtnode, bool below_outer_join, bool append_rel_member); extern void reduce_outer_joins(PlannerInfo *root); -extern Relids get_relids_in_jointree(Node *jtnode); +extern Relids get_relids_in_jointree(Node *jtnode, bool include_joins); extern Relids get_relids_for_join(PlannerInfo *root, int joinrelid); /* -- cgit v1.2.1