summaryrefslogtreecommitdiff
path: root/src/backend/access/nbtree/nbtutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/nbtree/nbtutils.c')
-rw-r--r--src/backend/access/nbtree/nbtutils.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c
index 8c5509f4a2c..83c553ca279 100644
--- a/src/backend/access/nbtree/nbtutils.c
+++ b/src/backend/access/nbtree/nbtutils.c
@@ -63,26 +63,17 @@ _bt_mkscankey(Relation rel, IndexTuple itup)
{
ScanKey skey;
TupleDesc itupdesc;
- int indnatts,
- indnkeyatts;
+ int natts;
int16 *indoption;
int i;
itupdesc = RelationGetDescr(rel);
- indnatts = IndexRelationGetNumberOfAttributes(rel);
- indnkeyatts = IndexRelationGetNumberOfKeyAttributes(rel);
+ natts = RelationGetNumberOfAttributes(rel);
indoption = rel->rd_indoption;
- Assert(indnkeyatts != 0);
- Assert(indnkeyatts <= indnatts);
+ skey = (ScanKey) palloc(natts * sizeof(ScanKeyData));
- /*
- * We'll execute search using ScanKey constructed on key columns.
- * Non key (included) columns must be omitted.
- */
- skey = (ScanKey) palloc(indnkeyatts * sizeof(ScanKeyData));
-
- for (i = 0; i < indnkeyatts; i++)
+ for (i = 0; i < natts; i++)
{
FmgrInfo *procinfo;
Datum arg;
@@ -124,16 +115,16 @@ ScanKey
_bt_mkscankey_nodata(Relation rel)
{
ScanKey skey;
- int indnkeyatts;
+ int natts;
int16 *indoption;
int i;
- indnkeyatts = IndexRelationGetNumberOfKeyAttributes(rel);
+ natts = RelationGetNumberOfAttributes(rel);
indoption = rel->rd_indoption;
- skey = (ScanKey) palloc(indnkeyatts * sizeof(ScanKeyData));
+ skey = (ScanKey) palloc(natts * sizeof(ScanKeyData));
- for (i = 0; i < indnkeyatts; i++)
+ for (i = 0; i < natts; i++)
{
FmgrInfo *procinfo;
int flags;