diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/nodes/nodes.h | 3 | ||||
| -rw-r--r-- | src/include/nodes/primnodes.h | 8 | ||||
| -rw-r--r-- | src/include/nodes/relation.h | 33 | ||||
| -rw-r--r-- | src/include/optimizer/subselect.h | 16 |
4 files changed, 20 insertions, 40 deletions
diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index 31881976bd..11e31e0a65 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.220 2009/02/02 19:31:40 alvherre Exp $ + * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.221 2009/02/25 03:30:37 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -216,7 +216,6 @@ typedef enum NodeTag T_PathKey, T_RestrictInfo, T_InnerIndexscanInfo, - T_FlattenedSubLink, T_PlaceHolderVar, T_SpecialJoinInfo, T_AppendRelInfo, diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 0d8efbe988..3315329923 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -10,7 +10,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.145 2009/01/01 17:24:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.146 2009/02/25 03:30:37 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1137,7 +1137,9 @@ typedef struct RangeTblRef * * During parse analysis, an RTE is created for the Join, and its index * is filled into rtindex. This RTE is present mainly so that Vars can - * be created that refer to the outputs of the join. + * be created that refer to the outputs of the join. The planner sometimes + * generates JoinExprs internally; these can have rtindex = 0 if there are + * no join alias variables referencing such joins. *---------- */ typedef struct JoinExpr @@ -1150,7 +1152,7 @@ typedef struct JoinExpr List *using; /* USING clause, if any (list of String) */ Node *quals; /* qualifiers on join, if any */ Alias *alias; /* user-written alias clause, if any */ - int rtindex; /* RT index assigned for join */ + int rtindex; /* RT index assigned for join, or 0 */ } JoinExpr; /*---------- diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index f00d1becc7..e8e20d202b 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.168 2009/02/06 23:43:24 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.169 2009/02/25 03:30:37 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1076,30 +1076,6 @@ typedef struct InnerIndexscanInfo } InnerIndexscanInfo; /* - * "Flattened SubLinks" - * - * When we pull an IN or EXISTS SubLink up into the parent query, the - * join conditions extracted from the IN/EXISTS clause need to be specially - * treated in distribute_qual_to_rels processing. We handle this by - * wrapping such expressions in a FlattenedSubLink node that identifies - * the join they come from. The FlattenedSubLink node is discarded after - * distribute_qual_to_rels, having served its purpose. - * - * Although the planner treats this as an expression node type, it is not - * recognized by the parser or executor, so we declare it here rather than - * in primnodes.h. - */ - -typedef struct FlattenedSubLink -{ - Expr xpr; - JoinType jointype; /* must be JOIN_SEMI or JOIN_ANTI */ - Relids lefthand; /* base relids treated as syntactic LHS */ - Relids righthand; /* base relids syntactically within RHS */ - Expr *quals; /* join quals (in explicit-AND format) */ -} FlattenedSubLink; - -/* * Placeholder node for an expression to be evaluated below the top level * of a plan tree. This is used during planning to represent the contained * expression. At the end of the planning process it is replaced by either @@ -1171,8 +1147,11 @@ typedef struct PlaceHolderVar * For purposes of join selectivity estimation, we create transient * SpecialJoinInfo structures for regular inner joins; so it is possible * to have jointype == JOIN_INNER in such a structure, even though this is - * not allowed within join_info_list. Note that lhs_strict, delay_upper_joins, - * and join_quals are not set meaningfully for such structs. + * not allowed within join_info_list. We also create transient + * SpecialJoinInfos with jointype == JOIN_INNER for outer joins, since for + * cost estimation purposes it is sometimes useful to know the join size under + * plain innerjoin semantics. Note that lhs_strict, delay_upper_joins, and + * join_quals are not set meaningfully within such structs. */ typedef struct SpecialJoinInfo diff --git a/src/include/optimizer/subselect.h b/src/include/optimizer/subselect.h index 54965a5fe7..a318853596 100644 --- a/src/include/optimizer/subselect.h +++ b/src/include/optimizer/subselect.h @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/subselect.h,v 1.35 2009/01/01 17:24:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/subselect.h,v 1.36 2009/02/25 03:30:38 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -16,13 +16,13 @@ #include "nodes/relation.h" extern void SS_process_ctes(PlannerInfo *root); -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 JoinExpr *convert_ANY_sublink_to_join(PlannerInfo *root, + SubLink *sublink, + Relids available_rels); +extern JoinExpr *convert_EXISTS_sublink_to_join(PlannerInfo *root, + SubLink *sublink, + bool under_not, + Relids available_rels); 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, |
