mirror of
https://github.com/postgres/postgres.git
synced 2025-05-05 09:19:17 +03:00
Code review for 6190d828cd2
* Fix the comment of init_dummy_sjinfo() to remove references to non-existing parameters 'rel1' and 'rel2'. * Adjust consider_new_or_clause() to call init_dummy_sjinfo() to make up a SpecialJoinInfo for inner joins like other code sites that were adjusted in 6190d828cd2 to do so. Author: Richard Guo <guofenglinux@gmail.com> Reported-by: Richard Guo <guofenglinux@gmail.com> Discussion: https://postgr.es/m/CAExHW5tHqEf3ASVqvFFcghYGPfpy7o3xnvhHwBGbJFMRH8KjNw@mail.gmail.com
This commit is contained in:
parent
cc0e7ebd30
commit
0f7863afef
@ -656,8 +656,9 @@ join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* init_dummy_sjinfo
|
* init_dummy_sjinfo
|
||||||
* Populate the given SpecialJoinInfo for a plain inner join between rel1
|
* Populate the given SpecialJoinInfo for a plain inner join between the
|
||||||
* and rel2
|
* left and right relations specified by left_relids and right_relids
|
||||||
|
* respectively.
|
||||||
*
|
*
|
||||||
* Normally, an inner join does not have a SpecialJoinInfo node associated with
|
* Normally, an inner join does not have a SpecialJoinInfo node associated with
|
||||||
* it. But some functions involved in join planning require one containing at
|
* it. But some functions involved in join planning require one containing at
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "nodes/nodeFuncs.h"
|
#include "nodes/nodeFuncs.h"
|
||||||
#include "optimizer/optimizer.h"
|
#include "optimizer/optimizer.h"
|
||||||
#include "optimizer/orclauses.h"
|
#include "optimizer/orclauses.h"
|
||||||
|
#include "optimizer/paths.h"
|
||||||
#include "optimizer/restrictinfo.h"
|
#include "optimizer/restrictinfo.h"
|
||||||
|
|
||||||
|
|
||||||
@ -325,24 +326,10 @@ consider_new_or_clause(PlannerInfo *root, RelOptInfo *rel,
|
|||||||
* Make up a SpecialJoinInfo for JOIN_INNER semantics. (Compare
|
* Make up a SpecialJoinInfo for JOIN_INNER semantics. (Compare
|
||||||
* approx_tuple_count() in costsize.c.)
|
* approx_tuple_count() in costsize.c.)
|
||||||
*/
|
*/
|
||||||
sjinfo.type = T_SpecialJoinInfo;
|
init_dummy_sjinfo(&sjinfo,
|
||||||
sjinfo.min_lefthand = bms_difference(join_or_rinfo->clause_relids,
|
bms_difference(join_or_rinfo->clause_relids,
|
||||||
|
rel->relids),
|
||||||
rel->relids);
|
rel->relids);
|
||||||
sjinfo.min_righthand = rel->relids;
|
|
||||||
sjinfo.syn_lefthand = sjinfo.min_lefthand;
|
|
||||||
sjinfo.syn_righthand = sjinfo.min_righthand;
|
|
||||||
sjinfo.jointype = JOIN_INNER;
|
|
||||||
sjinfo.ojrelid = 0;
|
|
||||||
sjinfo.commute_above_l = NULL;
|
|
||||||
sjinfo.commute_above_r = NULL;
|
|
||||||
sjinfo.commute_below_l = NULL;
|
|
||||||
sjinfo.commute_below_r = NULL;
|
|
||||||
/* we don't bother trying to make the remaining fields valid */
|
|
||||||
sjinfo.lhs_strict = false;
|
|
||||||
sjinfo.semi_can_btree = false;
|
|
||||||
sjinfo.semi_can_hash = false;
|
|
||||||
sjinfo.semi_operators = NIL;
|
|
||||||
sjinfo.semi_rhs_exprs = NIL;
|
|
||||||
|
|
||||||
/* Compute inner-join size */
|
/* Compute inner-join size */
|
||||||
orig_selec = clause_selectivity(root, (Node *) join_or_rinfo,
|
orig_selec = clause_selectivity(root, (Node *) join_or_rinfo,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user