summaryrefslogtreecommitdiff
path: root/src/backend/access/index/genam.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/index/genam.c')
-rw-r--r--src/backend/access/index/genam.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c
index de5781458e3..65c941d812c 100644
--- a/src/backend/access/index/genam.c
+++ b/src/backend/access/index/genam.c
@@ -174,15 +174,13 @@ BuildIndexValueDescription(Relation indexRelation,
StringInfoData buf;
Form_pg_index idxrec;
HeapTuple ht_idx;
- int indnkeyatts;
+ int natts = indexRelation->rd_rel->relnatts;
int i;
int keyno;
Oid indexrelid = RelationGetRelid(indexRelation);
Oid indrelid;
AclResult aclresult;
- indnkeyatts = IndexRelationGetNumberOfKeyAttributes(indexRelation);
-
/*
* Check permissions- if the user does not have access to view all of the
* key columns then return NULL to avoid leaking data.
@@ -220,7 +218,7 @@ BuildIndexValueDescription(Relation indexRelation,
* No table-level access, so step through the columns in the index and
* make sure the user has SELECT rights on all of them.
*/
- for (keyno = 0; keyno < idxrec->indnkeyatts; keyno++)
+ for (keyno = 0; keyno < idxrec->indnatts; keyno++)
{
AttrNumber attnum = idxrec->indkey.values[keyno];
@@ -246,7 +244,7 @@ BuildIndexValueDescription(Relation indexRelation,
appendStringInfo(&buf, "(%s)=(",
pg_get_indexdef_columns(indexrelid, true));
- for (i = 0; i < indnkeyatts; i++)
+ for (i = 0; i < natts; i++)
{
char *val;
@@ -364,7 +362,7 @@ systable_beginscan(Relation heapRelation,
{
int j;
- for (j = 0; j < IndexRelationGetNumberOfAttributes(irel); j++)
+ for (j = 0; j < irel->rd_index->indnatts; j++)
{
if (key[i].sk_attno == irel->rd_index->indkey.values[j])
{
@@ -372,7 +370,7 @@ systable_beginscan(Relation heapRelation,
break;
}
}
- if (j == IndexRelationGetNumberOfAttributes(irel))
+ if (j == irel->rd_index->indnatts)
elog(ERROR, "column is not in index");
}
@@ -566,7 +564,7 @@ systable_beginscan_ordered(Relation heapRelation,
{
int j;
- for (j = 0; j < IndexRelationGetNumberOfAttributes(indexRelation); j++)
+ for (j = 0; j < indexRelation->rd_index->indnatts; j++)
{
if (key[i].sk_attno == indexRelation->rd_index->indkey.values[j])
{
@@ -574,7 +572,7 @@ systable_beginscan_ordered(Relation heapRelation,
break;
}
}
- if (j == IndexRelationGetNumberOfAttributes(indexRelation))
+ if (j == indexRelation->rd_index->indnatts)
elog(ERROR, "column is not in index");
}