Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8202b0e

Browse files
committed
Refactor variable names in remove_self_joins_one_group()
Rename inner and outer to rrel and krel, respectively, to highlight theirconnection to r and k indexes. For the same reason, rename imark and omarkto rmark and kmark.Discussion:https://postgr.es/m/18c6bd6c-6d2a-419a-b0da-dfedef34b585%40gmail.comAuthor: Andrei Lepikhov <lepihov@gmail.com>Reviewed-by: Greg Sabino Mullane <htamfids@gmail.com>Backpatch-through: 18
1 parent9d115b9 commit8202b0e

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

‎src/backend/optimizer/plan/analyzejoins.c‎

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,21 +2142,21 @@ remove_self_joins_one_group(PlannerInfo *root, Relids relids)
21422142

21432143
while ((r=bms_next_member(relids,r))>0)
21442144
{
2145-
RelOptInfo*inner=root->simple_rel_array[r];
2145+
RelOptInfo*rrel=root->simple_rel_array[r];
21462146

21472147
k=r;
21482148

21492149
while ((k=bms_next_member(relids,k))>0)
21502150
{
21512151
Relidsjoinrelids=NULL;
2152-
RelOptInfo*outer=root->simple_rel_array[k];
2152+
RelOptInfo*krel=root->simple_rel_array[k];
21532153
List*restrictlist;
21542154
List*selfjoinquals;
21552155
List*otherjoinquals;
21562156
ListCell*lc;
21572157
booljinfo_check= true;
2158-
PlanRowMark*omark=NULL;
2159-
PlanRowMark*imark=NULL;
2158+
PlanRowMark*kmark=NULL;
2159+
PlanRowMark*rmark=NULL;
21602160
List*uclauses=NIL;
21612161

21622162
/* A sanity check: the relations have the same Oid. */
@@ -2196,19 +2196,19 @@ remove_self_joins_one_group(PlannerInfo *root, Relids relids)
21962196

21972197
if (rowMark->rti==k)
21982198
{
2199-
Assert(imark==NULL);
2200-
imark=rowMark;
2199+
Assert(rmark==NULL);
2200+
rmark=rowMark;
22012201
}
22022202
elseif (rowMark->rti==r)
22032203
{
2204-
Assert(omark==NULL);
2205-
omark=rowMark;
2204+
Assert(kmark==NULL);
2205+
kmark=rowMark;
22062206
}
22072207

2208-
if (omark&&imark)
2208+
if (kmark&&rmark)
22092209
break;
22102210
}
2211-
if (omark&&imark&&omark->markType!=imark->markType)
2211+
if (kmark&&rmark&&kmark->markType!=rmark->markType)
22122212
continue;
22132213

22142214
/*
@@ -2229,8 +2229,8 @@ remove_self_joins_one_group(PlannerInfo *root, Relids relids)
22292229
* build_joinrel_restrictlist() routine.
22302230
*/
22312231
restrictlist=generate_join_implied_equalities(root,joinrelids,
2232-
inner->relids,
2233-
outer,NULL);
2232+
rrel->relids,
2233+
krel,NULL);
22342234
if (restrictlist==NIL)
22352235
continue;
22362236

@@ -2240,7 +2240,7 @@ remove_self_joins_one_group(PlannerInfo *root, Relids relids)
22402240
* otherjoinquals.
22412241
*/
22422242
split_selfjoin_quals(root,restrictlist,&selfjoinquals,
2243-
&otherjoinquals,inner->relid,outer->relid);
2243+
&otherjoinquals,rrel->relid,krel->relid);
22442244

22452245
Assert(list_length(restrictlist)==
22462246
(list_length(selfjoinquals)+list_length(otherjoinquals)));
@@ -2251,17 +2251,17 @@ remove_self_joins_one_group(PlannerInfo *root, Relids relids)
22512251
* degenerate case works only if both sides have the same clause.
22522252
* So doesn't matter which side to add.
22532253
*/
2254-
selfjoinquals=list_concat(selfjoinquals,outer->baserestrictinfo);
2254+
selfjoinquals=list_concat(selfjoinquals,krel->baserestrictinfo);
22552255

22562256
/*
2257-
* Determine if theinner tablecan duplicate outer rows. We must
2258-
*bypassthe unique rel cache here since we're possibly using a
2259-
*subsetof join quals. We can use 'force_cache' == true when all
2260-
*joinquals are self-join quals. Otherwise, we could end up
2261-
*puttingfalse negatives in the cache.
2257+
* Determine if therrelcan duplicate outer rows. We must bypass
2258+
* the unique rel cache here since we're possibly using a subset
2259+
* of join quals. We can use 'force_cache' == true when all join
2260+
* quals are self-join quals. Otherwise, we could end up putting
2261+
* false negatives in the cache.
22622262
*/
2263-
if (!innerrel_is_unique_ext(root,joinrelids,inner->relids,
2264-
outer,JOIN_INNER,selfjoinquals,
2263+
if (!innerrel_is_unique_ext(root,joinrelids,rrel->relids,
2264+
krel,JOIN_INNER,selfjoinquals,
22652265
list_length(otherjoinquals)==0,
22662266
&uclauses))
22672267
continue;
@@ -2277,14 +2277,14 @@ remove_self_joins_one_group(PlannerInfo *root, Relids relids)
22772277
* expressions, or we won't match the same row on each side of the
22782278
* join.
22792279
*/
2280-
if (!match_unique_clauses(root,inner,uclauses,outer->relid))
2280+
if (!match_unique_clauses(root,rrel,uclauses,krel->relid))
22812281
continue;
22822282

22832283
/*
2284-
*We can remove either relation, so removetheinner one in order
2285-
*to simplify this loop.
2284+
*Remove rrel ReloptInfo fromtheplanner structures and the
2285+
*corresponding row mark.
22862286
*/
2287-
remove_self_join_rel(root,omark,imark,outer,inner,restrictlist);
2287+
remove_self_join_rel(root,kmark,rmark,krel,rrel,restrictlist);
22882288

22892289
result=bms_add_member(result,r);
22902290

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp