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

Commit99bc012

Browse files
committed
Minor cleanup of indxpath.c.
Eliminate some superfluous notational complexity aroundmatch_clause_to_indexcol(), and rip out the DoneMatchingIndexKeyscrock.
1 parentd1d8462 commit99bc012

File tree

1 file changed

+8
-27
lines changed

1 file changed

+8
-27
lines changed

‎src/backend/optimizer/path/indxpath.c

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@
3737
#include"utils/selfuncs.h"
3838

3939

40-
/*
41-
* DoneMatchingIndexKeys() - MACRO
42-
*/
43-
#defineDoneMatchingIndexKeys(families) (families[0] == InvalidOid)
44-
4540
#defineIsBooleanOpfamily(opfamily) \
4641
((opfamily) == BOOL_BTREE_FAM_OID || (opfamily) == BOOL_HASH_FAM_OID)
4742

@@ -83,7 +78,7 @@ static PathClauseUsage *classify_index_clause_usage(Path *path,
8378
staticvoidfind_indexpath_quals(Path*bitmapqual,List**quals,List**preds);
8479
staticintfind_list_position(Node*node,List**nodelist);
8580
staticboolmatch_clause_to_indexcol(IndexOptInfo*index,
86-
intindexcol,Oidopfamily,
81+
intindexcol,
8782
RestrictInfo*rinfo,
8883
Relidsouter_relids,
8984
SaOpControlsaop_control);
@@ -1053,7 +1048,6 @@ group_clauses_by_indexkey(IndexOptInfo *index,
10531048
List*clausegroup_list=NIL;
10541049
boolfound_outer_clause= false;
10551050
intindexcol=0;
1056-
Oid*families=index->opfamily;
10571051

10581052
*found_clause= false;/* default result */
10591053

@@ -1062,7 +1056,6 @@ group_clauses_by_indexkey(IndexOptInfo *index,
10621056

10631057
do
10641058
{
1065-
OidcurFamily=families[0];
10661059
List*clausegroup=NIL;
10671060
ListCell*l;
10681061

@@ -1074,7 +1067,6 @@ group_clauses_by_indexkey(IndexOptInfo *index,
10741067
Assert(IsA(rinfo,RestrictInfo));
10751068
if (match_clause_to_indexcol(index,
10761069
indexcol,
1077-
curFamily,
10781070
rinfo,
10791071
outer_relids,
10801072
saop_control))
@@ -1094,7 +1086,6 @@ group_clauses_by_indexkey(IndexOptInfo *index,
10941086
Assert(IsA(rinfo,RestrictInfo));
10951087
if (match_clause_to_indexcol(index,
10961088
indexcol,
1097-
curFamily,
10981089
rinfo,
10991090
outer_relids,
11001091
saop_control))
@@ -1113,9 +1104,8 @@ group_clauses_by_indexkey(IndexOptInfo *index,
11131104
clausegroup_list=lappend(clausegroup_list,clausegroup);
11141105

11151106
indexcol++;
1116-
families++;
11171107

1118-
}while (!DoneMatchingIndexKeys(families));
1108+
}while (indexcol<index->ncolumns);
11191109

11201110
if (!*found_clause&& !found_outer_clause)
11211111
returnNIL;/* no indexable clauses anywhere */
@@ -1185,7 +1175,6 @@ group_clauses_by_indexkey(IndexOptInfo *index,
11851175
staticbool
11861176
match_clause_to_indexcol(IndexOptInfo*index,
11871177
intindexcol,
1188-
Oidopfamily,
11891178
RestrictInfo*rinfo,
11901179
Relidsouter_relids,
11911180
SaOpControlsaop_control)
@@ -1196,6 +1185,7 @@ match_clause_to_indexcol(IndexOptInfo *index,
11961185
Relidsleft_relids;
11971186
Relidsright_relids;
11981187
Oidexpr_op;
1188+
Oidopfamily=index->opfamily[indexcol];
11991189
boolplain_op;
12001190

12011191
/*
@@ -1582,23 +1572,18 @@ matches_any_index(RestrictInfo *rinfo, RelOptInfo *rel, Relids outer_relids)
15821572
{
15831573
IndexOptInfo*index= (IndexOptInfo*)lfirst(l);
15841574
intindexcol=0;
1585-
Oid*families=index->opfamily;
15861575

15871576
do
15881577
{
1589-
OidcurFamily=families[0];
1590-
15911578
if (match_clause_to_indexcol(index,
15921579
indexcol,
1593-
curFamily,
15941580
rinfo,
15951581
outer_relids,
15961582
SAOP_ALLOW))
15971583
return true;
15981584

15991585
indexcol++;
1600-
families++;
1601-
}while (!DoneMatchingIndexKeys(families));
1586+
}while (indexcol<index->ncolumns);
16021587
}
16031588

16041589
return false;
@@ -1621,11 +1606,10 @@ eclass_matches_any_index(EquivalenceClass *ec, EquivalenceMember *em,
16211606
{
16221607
IndexOptInfo*index= (IndexOptInfo*)lfirst(l);
16231608
intindexcol=0;
1624-
Oid*families=index->opfamily;
16251609

16261610
do
16271611
{
1628-
OidcurFamily=families[0];
1612+
OidcurFamily=index->opfamily[indexcol];
16291613

16301614
/*
16311615
* If it's a btree index, we can reject it if its opfamily isn't
@@ -1643,8 +1627,7 @@ eclass_matches_any_index(EquivalenceClass *ec, EquivalenceMember *em,
16431627
return true;
16441628

16451629
indexcol++;
1646-
families++;
1647-
}while (!DoneMatchingIndexKeys(families));
1630+
}while (indexcol<index->ncolumns);
16481631
}
16491632

16501633
return false;
@@ -2379,15 +2362,14 @@ expand_indexqual_conditions(IndexOptInfo *index, List *clausegroups)
23792362
List*resultquals=NIL;
23802363
ListCell*clausegroup_item;
23812364
intindexcol=0;
2382-
Oid*families=index->opfamily;
23832365

23842366
if (clausegroups==NIL)
23852367
returnNIL;
23862368

23872369
clausegroup_item=list_head(clausegroups);
23882370
do
23892371
{
2390-
OidcurFamily=families[0];
2372+
OidcurFamily=index->opfamily[indexcol];
23912373
ListCell*l;
23922374

23932375
foreach(l, (List*)lfirst(clausegroup_item))
@@ -2447,8 +2429,7 @@ expand_indexqual_conditions(IndexOptInfo *index, List *clausegroups)
24472429
clausegroup_item=lnext(clausegroup_item);
24482430

24492431
indexcol++;
2450-
families++;
2451-
}while (clausegroup_item!=NULL&& !DoneMatchingIndexKeys(families));
2432+
}while (clausegroup_item!=NULL&&indexcol<index->ncolumns);
24522433

24532434
Assert(clausegroup_item==NULL);/* else more groups than indexkeys */
24542435

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp