Skip to content

Commit 0f7863a

Browse files
committed
Code review for 6190d82
* 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 6190d82 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
1 parent cc0e7eb commit 0f7863a

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

src/backend/optimizer/path/joinrels.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,9 @@ join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
656656

657657
/*
658658
* init_dummy_sjinfo
659-
* Populate the given SpecialJoinInfo for a plain inner join between rel1
660-
* and rel2
659+
* Populate the given SpecialJoinInfo for a plain inner join between the
660+
* left and right relations specified by left_relids and right_relids
661+
* respectively.
661662
*
662663
* Normally, an inner join does not have a SpecialJoinInfo node associated with
663664
* it. But some functions involved in join planning require one containing at

src/backend/optimizer/util/orclauses.c

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "nodes/nodeFuncs.h"
2020
#include "optimizer/optimizer.h"
2121
#include "optimizer/orclauses.h"
22+
#include "optimizer/paths.h"
2223
#include "optimizer/restrictinfo.h"
2324

2425

@@ -325,24 +326,10 @@ consider_new_or_clause(PlannerInfo *root, RelOptInfo *rel,
325326
* Make up a SpecialJoinInfo for JOIN_INNER semantics. (Compare
326327
* approx_tuple_count() in costsize.c.)
327328
*/
328-
sjinfo.type = T_SpecialJoinInfo;
329-
sjinfo.min_lefthand = bms_difference(join_or_rinfo->clause_relids,
330-
rel->relids);
331-
sjinfo.min_righthand = rel->relids;
332-
sjinfo.syn_lefthand = sjinfo.min_lefthand;
333-
sjinfo.syn_righthand = sjinfo.min_righthand;
334-
sjinfo.jointype = JOIN_INNER;
335-
sjinfo.ojrelid = 0;
336-
sjinfo.commute_above_l = NULL;
337-
sjinfo.commute_above_r = NULL;
338-
sjinfo.commute_below_l = NULL;
339-
sjinfo.commute_below_r = NULL;
340-
/* we don't bother trying to make the remaining fields valid */
341-
sjinfo.lhs_strict = false;
342-
sjinfo.semi_can_btree = false;
343-
sjinfo.semi_can_hash = false;
344-
sjinfo.semi_operators = NIL;
345-
sjinfo.semi_rhs_exprs = NIL;
329+
init_dummy_sjinfo(&sjinfo,
330+
bms_difference(join_or_rinfo->clause_relids,
331+
rel->relids),
332+
rel->relids);
346333

347334
/* Compute inner-join size */
348335
orig_selec = clause_selectivity(root, (Node *) join_or_rinfo,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy