simplify_match_clause_to_indexcol_api.patch
text/x-patch
Filename: simplify_match_clause_to_indexcol_api.patch
Type: text/x-patch
Part: 0
Message:
match_clause_to_indexcol()
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/backend/optimizer/path/indxpath.c | 4 | 14 |
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index 38b0930..7b8fd97 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -83,7 +83,7 @@ static PathClauseUsage *classify_index_clause_usage(Path *path,
static void find_indexpath_quals(Path *bitmapqual, List **quals, List **preds);
static int find_list_position(Node *node, List **nodelist);
static bool match_clause_to_indexcol(IndexOptInfo *index,
- int indexcol, Oid opfamily,
+ int indexcol,
RestrictInfo *rinfo,
Relids outer_relids,
SaOpControl saop_control);
@@ -1053,7 +1053,6 @@ group_clauses_by_indexkey(IndexOptInfo *index,
List *clausegroup_list = NIL;
bool found_outer_clause = false;
int indexcol = 0;
- Oid *families = index->opfamily;
*found_clause = false; /* default result */
@@ -1062,7 +1061,6 @@ group_clauses_by_indexkey(IndexOptInfo *index,
do
{
- Oid curFamily = families[0];
List *clausegroup = NIL;
ListCell *l;
@@ -1074,7 +1072,6 @@ group_clauses_by_indexkey(IndexOptInfo *index,
Assert(IsA(rinfo, RestrictInfo));
if (match_clause_to_indexcol(index,
indexcol,
- curFamily,
rinfo,
outer_relids,
saop_control))
@@ -1094,7 +1091,6 @@ group_clauses_by_indexkey(IndexOptInfo *index,
Assert(IsA(rinfo, RestrictInfo));
if (match_clause_to_indexcol(index,
indexcol,
- curFamily,
rinfo,
outer_relids,
saop_control))
@@ -1113,9 +1109,8 @@ group_clauses_by_indexkey(IndexOptInfo *index,
clausegroup_list = lappend(clausegroup_list, clausegroup);
indexcol++;
- families++;
- } while (!DoneMatchingIndexKeys(families));
+ } while (indexcol < index->ncolumns);
if (!*found_clause && !found_outer_clause)
return NIL; /* no indexable clauses anywhere */
@@ -1185,7 +1180,6 @@ group_clauses_by_indexkey(IndexOptInfo *index,
static bool
match_clause_to_indexcol(IndexOptInfo *index,
int indexcol,
- Oid opfamily,
RestrictInfo *rinfo,
Relids outer_relids,
SaOpControl saop_control)
@@ -1196,6 +1190,7 @@ match_clause_to_indexcol(IndexOptInfo *index,
Relids left_relids;
Relids right_relids;
Oid expr_op;
+ Oid opfamily = index->opfamily[indexcol];
bool plain_op;
/*
@@ -1582,23 +1577,18 @@ matches_any_index(RestrictInfo *rinfo, RelOptInfo *rel, Relids outer_relids)
{
IndexOptInfo *index = (IndexOptInfo *) lfirst(l);
int indexcol = 0;
- Oid *families = index->opfamily;
do
{
- Oid curFamily = families[0];
-
if (match_clause_to_indexcol(index,
indexcol,
- curFamily,
rinfo,
outer_relids,
SAOP_ALLOW))
return true;
indexcol++;
- families++;
- } while (!DoneMatchingIndexKeys(families));
+ } while (indexcol < index->ncolumns);
}
return false;