#include "utils/selfuncs.h"
-/*
- * DoneMatchingIndexKeys() - MACRO
- */
-#define DoneMatchingIndexKeys(families) (families[0] == InvalidOid)
-
#define IsBooleanOpfamily(opfamily) \
((opfamily) == BOOL_BTREE_FAM_OID || (opfamily) == BOOL_HASH_FAM_OID)
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);
List *clausegroup_list = NIL;
bool found_outer_clause = false;
int indexcol = 0;
- Oid *families = index->opfamily;
*found_clause = false; /* default result */
do
{
- Oid curFamily = families[0];
List *clausegroup = NIL;
ListCell *l;
Assert(IsA(rinfo, RestrictInfo));
if (match_clause_to_indexcol(index,
indexcol,
- curFamily,
rinfo,
outer_relids,
saop_control))
Assert(IsA(rinfo, RestrictInfo));
if (match_clause_to_indexcol(index,
indexcol,
- curFamily,
rinfo,
outer_relids,
saop_control))
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 */
static bool
match_clause_to_indexcol(IndexOptInfo *index,
int indexcol,
- Oid opfamily,
RestrictInfo *rinfo,
Relids outer_relids,
SaOpControl saop_control)
Relids left_relids;
Relids right_relids;
Oid expr_op;
+ Oid opfamily = index->opfamily[indexcol];
bool plain_op;
/*
{
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;
{
IndexOptInfo *index = (IndexOptInfo *) lfirst(l);
int indexcol = 0;
- Oid *families = index->opfamily;
do
{
- Oid curFamily = families[0];
+ Oid curFamily = index->opfamily[indexcol];
/*
* If it's a btree index, we can reject it if its opfamily isn't
return true;
indexcol++;
- families++;
- } while (!DoneMatchingIndexKeys(families));
+ } while (indexcol < index->ncolumns);
}
return false;
List *resultquals = NIL;
ListCell *clausegroup_item;
int indexcol = 0;
- Oid *families = index->opfamily;
if (clausegroups == NIL)
return NIL;
clausegroup_item = list_head(clausegroups);
do
{
- Oid curFamily = families[0];
+ Oid curFamily = index->opfamily[indexcol];
ListCell *l;
foreach(l, (List *) lfirst(clausegroup_item))
clausegroup_item = lnext(clausegroup_item);
indexcol++;
- families++;
- } while (clausegroup_item != NULL && !DoneMatchingIndexKeys(families));
+ } while (clausegroup_item != NULL && indexcol < index->ncolumns);
Assert(clausegroup_item == NULL); /* else more groups than indexkeys */