summaryrefslogtreecommitdiff
path: root/src/backend/catalog/index.c
diff options
context:
space:
mode:
authorPeter Eisentraut2023-10-03 15:39:31 +0000
committerPeter Eisentraut2023-10-03 15:51:02 +0000
commit784162357130f63b5130cd6517db21451692f9b3 (patch)
treeedaaace4b2c7caff98af659aa544ee80b1c7c53d /src/backend/catalog/index.c
parentaf3ee8a086ca210d9461f813538d0169dbf07c2c (diff)
Remove IndexInfo.ii_OpclassOptions field
It is unnecessary to include this field in IndexInfo. It is only used by DDL code, not during execution. It is really only used to pass local information around between functions in index.c and indexcmds.c, for which it is clearer to use local variables, like in similar cases. Discussion: https://www.postgresql.org/message-id/flat/[email protected]
Diffstat (limited to 'src/backend/catalog/index.c')
-rw-r--r--src/backend/catalog/index.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 3d5adab2c53..143fae01ebd 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -720,6 +720,7 @@ index_create(Relation heapRelation,
Oid tableSpaceId,
const Oid *collationIds,
const Oid *opclassIds,
+ const Datum *opclassOptions,
const int16 *coloptions,
Datum reloptions,
bits16 flags,
@@ -1015,7 +1016,7 @@ index_create(Relation heapRelation,
/*
* append ATTRIBUTE tuples for the index
*/
- AppendAttributeTuples(indexRelation, indexInfo->ii_OpclassOptions);
+ AppendAttributeTuples(indexRelation, opclassOptions);
/* ----------------
* update pg_index
@@ -1223,10 +1224,10 @@ index_create(Relation heapRelation,
indexRelation->rd_index->indnkeyatts = indexInfo->ii_NumIndexKeyAttrs;
/* Validate opclass-specific options */
- if (indexInfo->ii_OpclassOptions)
+ if (opclassOptions)
for (i = 0; i < indexInfo->ii_NumIndexKeyAttrs; i++)
(void) index_opclass_options(indexRelation, i + 1,
- indexInfo->ii_OpclassOptions[i],
+ opclassOptions[i],
true);
/*
@@ -1290,7 +1291,8 @@ index_concurrently_create_copy(Relation heapRelation, Oid oldIndexId,
classTuple;
Datum indclassDatum,
colOptionDatum,
- optionDatum;
+ reloptionsDatum;
+ Datum *opclassOptions;
oidvector *indclass;
int2vector *indcoloptions;
bool isnull;
@@ -1324,12 +1326,12 @@ index_concurrently_create_copy(Relation heapRelation, Oid oldIndexId,
Anum_pg_index_indoption);
indcoloptions = (int2vector *) DatumGetPointer(colOptionDatum);
- /* Fetch options of index if any */
+ /* Fetch reloptions of index if any */
classTuple = SearchSysCache1(RELOID, ObjectIdGetDatum(oldIndexId));
if (!HeapTupleIsValid(classTuple))
elog(ERROR, "cache lookup failed for relation %u", oldIndexId);
- optionDatum = SysCacheGetAttr(RELOID, classTuple,
- Anum_pg_class_reloptions, &isnull);
+ reloptionsDatum = SysCacheGetAttr(RELOID, classTuple,
+ Anum_pg_class_reloptions, &isnull);
/*
* Fetch the list of expressions and predicates directly from the
@@ -1392,14 +1394,10 @@ index_concurrently_create_copy(Relation heapRelation, Oid oldIndexId,
newInfo->ii_IndexAttrNumbers[i] = oldInfo->ii_IndexAttrNumbers[i];
}
- /* Extract opclass parameters for each attribute, if any */
- if (oldInfo->ii_OpclassOptions != NULL)
- {
- newInfo->ii_OpclassOptions = palloc0(sizeof(Datum) *
- newInfo->ii_NumIndexAttrs);
- for (int i = 0; i < newInfo->ii_NumIndexAttrs; i++)
- newInfo->ii_OpclassOptions[i] = get_attoptions(oldIndexId, i + 1);
- }
+ /* Extract opclass options for each attribute */
+ opclassOptions = palloc0(sizeof(Datum) * newInfo->ii_NumIndexAttrs);
+ for (int i = 0; i < newInfo->ii_NumIndexAttrs; i++)
+ opclassOptions[i] = get_attoptions(oldIndexId, i + 1);
/*
* Now create the new index.
@@ -1420,8 +1418,9 @@ index_concurrently_create_copy(Relation heapRelation, Oid oldIndexId,
tablespaceOid,
indexRelation->rd_indcollation,
indclass->values,
+ opclassOptions,
indcoloptions->values,
- optionDatum,
+ reloptionsDatum,
INDEX_CREATE_SKIP_BUILD | INDEX_CREATE_CONCURRENT,
0,
true, /* allow table to be a system catalog? */
@@ -2464,8 +2463,6 @@ BuildIndexInfo(Relation index)
&ii->ii_ExclusionStrats);
}
- ii->ii_OpclassOptions = RelationGetIndexRawAttOptions(index);
-
return ii;
}