0002-Rename-some-function-arguments-for-better-clarity.patch

text/plain

Filename: 0002-Rename-some-function-arguments-for-better-clarity.patch
Type: text/plain
Part: 1
Message: some code cleanup in index.c and indexcmds.c

Patch

Format: format-patch
Series: patch 0002
Subject: Rename some function arguments for better clarity
File+
src/backend/catalog/index.c 31 31
src/backend/catalog/toasting.c 7 7
src/backend/commands/indexcmds.c 50 50
src/include/catalog/index.h 3 3
src/include/commands/defrem.h 1 1
From de6b80e54b05a2821adcea6bc3ef2b996eb2bfd2 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Wed, 16 Aug 2023 07:45:28 +0200
Subject: [PATCH 2/3] Rename some function arguments for better clarity

Especially make sure that array arguments have plural names.
---
 src/backend/catalog/index.c      |  62 +++++++++----------
 src/backend/catalog/toasting.c   |  14 ++---
 src/backend/commands/indexcmds.c | 100 +++++++++++++++----------------
 src/include/catalog/index.h      |   6 +-
 src/include/commands/defrem.h    |   2 +-
 5 files changed, 92 insertions(+), 92 deletions(-)

diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 2a30eb3a32..05b6f9ca1a 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -108,9 +108,9 @@ static bool relationHasPrimaryKey(Relation rel);
 static TupleDesc ConstructTupleDescriptor(Relation heapRelation,
 										  const IndexInfo *indexInfo,
 										  const List *indexColNames,
-										  Oid accessMethodObjectId,
-										  const Oid *collationObjectId,
-										  const Oid *classObjectId);
+										  Oid accessMethodId,
+										  const Oid *collationIds,
+										  const Oid *opclassIds);
 static void InitializeAttributeOids(Relation indexRelation,
 									int numatts, Oid indexoid);
 static void AppendAttributeTuples(Relation indexRelation, const Datum *attopts);
@@ -118,7 +118,7 @@ static void UpdateIndexRelation(Oid indexoid, Oid heapoid,
 								Oid parentIndexId,
 								const IndexInfo *indexInfo,
 								const Oid *collationOids,
-								const Oid *classOids,
+								const Oid *opclassOids,
 								const int16 *coloptions,
 								bool primary,
 								bool isexclusion,
@@ -286,9 +286,9 @@ static TupleDesc
 ConstructTupleDescriptor(Relation heapRelation,
 						 const IndexInfo *indexInfo,
 						 const List *indexColNames,
-						 Oid accessMethodObjectId,
-						 const Oid *collationObjectId,
-						 const Oid *classObjectId)
+						 Oid accessMethodId,
+						 const Oid *collationIds,
+						 const Oid *opclassIds)
 {
 	int			numatts = indexInfo->ii_NumIndexAttrs;
 	int			numkeyatts = indexInfo->ii_NumIndexKeyAttrs;
@@ -301,7 +301,7 @@ ConstructTupleDescriptor(Relation heapRelation,
 	int			i;
 
 	/* We need access to the index AM's API struct */
-	amroutine = GetIndexAmRoutineByAmId(accessMethodObjectId, false);
+	amroutine = GetIndexAmRoutineByAmId(accessMethodId, false);
 
 	/* ... and to the table's tuple descriptor */
 	heapTupDesc = RelationGetDescr(heapRelation);
@@ -330,7 +330,7 @@ ConstructTupleDescriptor(Relation heapRelation,
 		to->attcacheoff = -1;
 		to->attislocal = true;
 		to->attcollation = (i < numkeyatts) ?
-			collationObjectId[i] : InvalidOid;
+			collationIds[i] : InvalidOid;
 
 		/*
 		 * Set the attribute name as specified by caller.
@@ -436,10 +436,10 @@ ConstructTupleDescriptor(Relation heapRelation,
 
 		if (i < indexInfo->ii_NumIndexKeyAttrs)
 		{
-			tuple = SearchSysCache1(CLAOID, ObjectIdGetDatum(classObjectId[i]));
+			tuple = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclassIds[i]));
 			if (!HeapTupleIsValid(tuple))
 				elog(ERROR, "cache lookup failed for opclass %u",
-					 classObjectId[i]);
+					 opclassIds[i]);
 			opclassTup = (Form_pg_opclass) GETSTRUCT(tuple);
 			if (OidIsValid(opclassTup->opckeytype))
 				keyType = opclassTup->opckeytype;
@@ -553,7 +553,7 @@ UpdateIndexRelation(Oid indexoid,
 					Oid parentIndexId,
 					const IndexInfo *indexInfo,
 					const Oid *collationOids,
-					const Oid *classOids,
+					const Oid *opclassOids,
 					const int16 *coloptions,
 					bool primary,
 					bool isexclusion,
@@ -581,7 +581,7 @@ UpdateIndexRelation(Oid indexoid,
 	for (i = 0; i < indexInfo->ii_NumIndexAttrs; i++)
 		indkey->values[i] = indexInfo->ii_IndexAttrNumbers[i];
 	indcollation = buildoidvector(collationOids, indexInfo->ii_NumIndexKeyAttrs);
-	indclass = buildoidvector(classOids, indexInfo->ii_NumIndexKeyAttrs);
+	indclass = buildoidvector(opclassOids, indexInfo->ii_NumIndexKeyAttrs);
 	indoption = buildint2vector(coloptions, indexInfo->ii_NumIndexKeyAttrs);
 
 	/*
@@ -679,10 +679,10 @@ UpdateIndexRelation(Oid indexoid,
  *		May be nonzero to attach an existing valid build.
  * indexInfo: same info executor uses to insert into the index
  * indexColNames: column names to use for index (List of char *)
- * accessMethodObjectId: OID of index AM to use
+ * accessMethodId: OID of index AM to use
  * tableSpaceId: OID of tablespace to use
- * collationObjectId: array of collation OIDs, one per index column
- * classObjectId: array of index opclass OIDs, one per index column
+ * collationIds: array of collation OIDs, one per index column
+ * opclassIds: array of index opclass OIDs, one per index column
  * coloptions: array of per-index-column indoption settings
  * reloptions: AM-specific options
  * flags: bitmask that can include any combination of these bits:
@@ -719,10 +719,10 @@ index_create(Relation heapRelation,
 			 RelFileNumber relFileNumber,
 			 IndexInfo *indexInfo,
 			 const List *indexColNames,
-			 Oid accessMethodObjectId,
+			 Oid accessMethodId,
 			 Oid tableSpaceId,
-			 const Oid *collationObjectId,
-			 const Oid *classObjectId,
+			 const Oid *collationIds,
+			 const Oid *opclassIds,
 			 const int16 *coloptions,
 			 Datum reloptions,
 			 bits16 flags,
@@ -806,8 +806,8 @@ index_create(Relation heapRelation,
 	 */
 	for (i = 0; i < indexInfo->ii_NumIndexKeyAttrs; i++)
 	{
-		Oid			collation = collationObjectId[i];
-		Oid			opclass = classObjectId[i];
+		Oid			collation = collationIds[i];
+		Oid			opclass = opclassIds[i];
 
 		if (collation)
 		{
@@ -908,9 +908,9 @@ index_create(Relation heapRelation,
 	indexTupDesc = ConstructTupleDescriptor(heapRelation,
 											indexInfo,
 											indexColNames,
-											accessMethodObjectId,
-											collationObjectId,
-											classObjectId);
+											accessMethodId,
+											collationIds,
+											opclassIds);
 
 	/*
 	 * Allocate an OID for the index, unless we were told what to use.
@@ -964,7 +964,7 @@ index_create(Relation heapRelation,
 								tableSpaceId,
 								indexRelationId,
 								relFileNumber,
-								accessMethodObjectId,
+								accessMethodId,
 								indexTupDesc,
 								relkind,
 								relpersistence,
@@ -993,7 +993,7 @@ index_create(Relation heapRelation,
 	 * XXX should have a cleaner way to create cataloged indexes
 	 */
 	indexRelation->rd_rel->relowner = heapRelation->rd_rel->relowner;
-	indexRelation->rd_rel->relam = accessMethodObjectId;
+	indexRelation->rd_rel->relam = accessMethodId;
 	indexRelation->rd_rel->relispartition = OidIsValid(parentIndexRelid);
 
 	/*
@@ -1030,7 +1030,7 @@ index_create(Relation heapRelation,
 	 */
 	UpdateIndexRelation(indexRelationId, heapRelationId, parentIndexRelid,
 						indexInfo,
-						collationObjectId, classObjectId, coloptions,
+						collationIds, opclassIds, coloptions,
 						isprimary, is_exclusion,
 						(constr_flags & INDEX_CONSTR_CREATE_DEFERRABLE) == 0,
 						!concurrent && !invalid,
@@ -1159,11 +1159,11 @@ index_create(Relation heapRelation,
 		/* The default collation is pinned, so don't bother recording it */
 		for (i = 0; i < indexInfo->ii_NumIndexKeyAttrs; i++)
 		{
-			if (OidIsValid(collationObjectId[i]) &&
-				collationObjectId[i] != DEFAULT_COLLATION_OID)
+			if (OidIsValid(collationIds[i]) &&
+				collationIds[i] != DEFAULT_COLLATION_OID)
 			{
 				ObjectAddressSet(referenced, CollationRelationId,
-								 collationObjectId[i]);
+								 collationIds[i]);
 				add_exact_object_address(&referenced, addrs);
 			}
 		}
@@ -1171,7 +1171,7 @@ index_create(Relation heapRelation,
 		/* Store dependency on operator classes */
 		for (i = 0; i < indexInfo->ii_NumIndexKeyAttrs; i++)
 		{
-			ObjectAddressSet(referenced, OperatorClassRelationId, classObjectId[i]);
+			ObjectAddressSet(referenced, OperatorClassRelationId, opclassIds[i]);
 			add_exact_object_address(&referenced, addrs);
 		}
 
diff --git a/src/backend/catalog/toasting.c b/src/backend/catalog/toasting.c
index ab12b0b9de..3fef593bf1 100644
--- a/src/backend/catalog/toasting.c
+++ b/src/backend/catalog/toasting.c
@@ -142,8 +142,8 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
 	char		toast_relname[NAMEDATALEN];
 	char		toast_idxname[NAMEDATALEN];
 	IndexInfo  *indexInfo;
-	Oid			collationObjectId[2];
-	Oid			classObjectId[2];
+	Oid			collationIds[2];
+	Oid			opclassIds[2];
 	int16		coloptions[2];
 	ObjectAddress baseobject,
 				toastobject;
@@ -312,11 +312,11 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
 	indexInfo->ii_AmCache = NULL;
 	indexInfo->ii_Context = CurrentMemoryContext;
 
-	collationObjectId[0] = InvalidOid;
-	collationObjectId[1] = InvalidOid;
+	collationIds[0] = InvalidOid;
+	collationIds[1] = InvalidOid;
 
-	classObjectId[0] = OID_BTREE_OPS_OID;
-	classObjectId[1] = INT4_BTREE_OPS_OID;
+	opclassIds[0] = OID_BTREE_OPS_OID;
+	opclassIds[1] = INT4_BTREE_OPS_OID;
 
 	coloptions[0] = 0;
 	coloptions[1] = 0;
@@ -327,7 +327,7 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
 				 list_make2("chunk_id", "chunk_seq"),
 				 BTREE_AM_OID,
 				 rel->rd_rel->reltablespace,
-				 collationObjectId, classObjectId, coloptions, (Datum) 0,
+				 collationIds, opclassIds, coloptions, (Datum) 0,
 				 INDEX_CREATE_IS_PRIMARY, 0, true, true, NULL);
 
 	table_close(toast_rel, NoLock);
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index 8e707d4ad9..0ed620ef65 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -74,10 +74,10 @@
 static bool CompareOpclassOptions(const Datum *opts1, const Datum *opts2, int natts);
 static void CheckPredicate(Expr *predicate);
 static void ComputeIndexAttrs(IndexInfo *indexInfo,
-							  Oid *typeOidP,
-							  Oid *collationOidP,
-							  Oid *classOidP,
-							  int16 *colOptionP,
+							  Oid *typeOids,
+							  Oid *collationOids,
+							  Oid *opclassOids,
+							  int16 *colOptions,
 							  const List *attList,
 							  const List *exclusionOpNames,
 							  Oid relId,
@@ -173,9 +173,9 @@ CheckIndexCompatible(Oid oldId,
 					 const List *exclusionOpNames)
 {
 	bool		isconstraint;
-	Oid		   *typeObjectId;
-	Oid		   *collationObjectId;
-	Oid		   *classObjectId;
+	Oid		   *typeIds;
+	Oid		   *collationIds;
+	Oid		   *opclassIds;
 	Oid			accessMethodId;
 	Oid			relationId;
 	HeapTuple	tuple;
@@ -234,12 +234,12 @@ CheckIndexCompatible(Oid oldId,
 	indexInfo = makeIndexInfo(numberOfAttributes, numberOfAttributes,
 							  accessMethodId, NIL, NIL, false, false,
 							  false, false, amsummarizing);
-	typeObjectId = palloc_array(Oid, numberOfAttributes);
-	collationObjectId = palloc_array(Oid, numberOfAttributes);
-	classObjectId = palloc_array(Oid, numberOfAttributes);
+	typeIds = palloc_array(Oid, numberOfAttributes);
+	collationIds = palloc_array(Oid, numberOfAttributes);
+	opclassIds = palloc_array(Oid, numberOfAttributes);
 	coloptions = palloc_array(int16, numberOfAttributes);
 	ComputeIndexAttrs(indexInfo,
-					  typeObjectId, collationObjectId, classObjectId,
+					  typeIds, collationIds, opclassIds,
 					  coloptions, attributeList,
 					  exclusionOpNames, relationId,
 					  accessMethodName, accessMethodId,
@@ -274,9 +274,9 @@ CheckIndexCompatible(Oid oldId,
 	d = SysCacheGetAttrNotNull(INDEXRELID, tuple, Anum_pg_index_indclass);
 	old_indclass = (oidvector *) DatumGetPointer(d);
 
-	ret = (memcmp(old_indclass->values, classObjectId,
+	ret = (memcmp(old_indclass->values, opclassIds,
 				  old_natts * sizeof(Oid)) == 0 &&
-		   memcmp(old_indcollation->values, collationObjectId,
+		   memcmp(old_indcollation->values, collationIds,
 				  old_natts * sizeof(Oid)) == 0);
 
 	ReleaseSysCache(tuple);
@@ -288,8 +288,8 @@ CheckIndexCompatible(Oid oldId,
 	irel = index_open(oldId, AccessShareLock);	/* caller probably has a lock */
 	for (i = 0; i < old_natts; i++)
 	{
-		if (IsPolymorphicType(get_opclass_input_type(classObjectId[i])) &&
-			TupleDescAttr(irel->rd_att, i)->atttypid != typeObjectId[i])
+		if (IsPolymorphicType(get_opclass_input_type(opclassIds[i])) &&
+			TupleDescAttr(irel->rd_att, i)->atttypid != typeIds[i])
 		{
 			ret = false;
 			break;
@@ -329,7 +329,7 @@ CheckIndexCompatible(Oid oldId,
 
 				op_input_types(indexInfo->ii_ExclusionOps[i], &left, &right);
 				if ((IsPolymorphicType(left) || IsPolymorphicType(right)) &&
-					TupleDescAttr(irel->rd_att, i)->atttypid != typeObjectId[i])
+					TupleDescAttr(irel->rd_att, i)->atttypid != typeIds[i])
 				{
 					ret = false;
 					break;
@@ -500,7 +500,7 @@ WaitForOlderSnapshots(TransactionId limitXmin, bool progress)
  * consider offering one DDL command for catalog setup and a separate DDL
  * command for steps that run opaque expressions.
  *
- * 'relationId': the OID of the heap relation on which the index is to be
+ * 'tableId': the OID of the table relation on which the index is to be
  *		created
  * 'stmt': IndexStmt describing the properties of the new index.
  * 'indexRelationId': normally InvalidOid, but during bootstrap can be
@@ -523,7 +523,7 @@ WaitForOlderSnapshots(TransactionId limitXmin, bool progress)
  * Returns the object address of the created index.
  */
 ObjectAddress
-DefineIndex(Oid relationId,
+DefineIndex(Oid tableId,
 			IndexStmt *stmt,
 			Oid indexRelationId,
 			Oid parentIndexId,
@@ -538,9 +538,9 @@ DefineIndex(Oid relationId,
 	bool		concurrent;
 	char	   *indexRelationName;
 	char	   *accessMethodName;
-	Oid		   *typeObjectId;
-	Oid		   *collationObjectId;
-	Oid		   *classObjectId;
+	Oid		   *typeIds;
+	Oid		   *collationIds;
+	Oid		   *opclassIds;
 	Oid			accessMethodId;
 	Oid			namespaceId;
 	Oid			tablespaceId;
@@ -592,7 +592,7 @@ DefineIndex(Oid relationId,
 	 * is more efficient.  Do this before any use of the concurrent option is
 	 * done.
 	 */
-	if (stmt->concurrent && get_rel_persistence(relationId) != RELPERSISTENCE_TEMP)
+	if (stmt->concurrent && get_rel_persistence(tableId) != RELPERSISTENCE_TEMP)
 		concurrent = true;
 	else
 		concurrent = false;
@@ -604,7 +604,7 @@ DefineIndex(Oid relationId,
 	if (!OidIsValid(parentIndexId))
 	{
 		pgstat_progress_start_command(PROGRESS_COMMAND_CREATE_INDEX,
-									  relationId);
+									  tableId);
 		pgstat_progress_update_param(PROGRESS_CREATEIDX_COMMAND,
 									 concurrent ?
 									 PROGRESS_CREATEIDX_COMMAND_CREATE_CONCURRENTLY :
@@ -649,7 +649,7 @@ DefineIndex(Oid relationId,
 	 * index build; but for concurrent builds we allow INSERT/UPDATE/DELETE
 	 * (but not VACUUM).
 	 *
-	 * NB: Caller is responsible for making sure that relationId refers to the
+	 * NB: Caller is responsible for making sure that tableId refers to the
 	 * relation on which the index should be built; except in bootstrap mode,
 	 * this will typically require the caller to have already locked the
 	 * relation.  To avoid lock upgrade hazards, that lock should be at least
@@ -660,7 +660,7 @@ DefineIndex(Oid relationId,
 	 * functions will need to be updated, too.
 	 */
 	lockmode = concurrent ? ShareUpdateExclusiveLock : ShareLock;
-	rel = table_open(relationId, lockmode);
+	rel = table_open(tableId, lockmode);
 
 	/*
 	 * Switch to the table owner's userid, so that any index functions are run
@@ -899,14 +899,14 @@ DefineIndex(Oid relationId,
 							  concurrent,
 							  amissummarizing);
 
-	typeObjectId = palloc_array(Oid, numberOfAttributes);
-	collationObjectId = palloc_array(Oid, numberOfAttributes);
-	classObjectId = palloc_array(Oid, numberOfAttributes);
+	typeIds = palloc_array(Oid, numberOfAttributes);
+	collationIds = palloc_array(Oid, numberOfAttributes);
+	opclassIds = palloc_array(Oid, numberOfAttributes);
 	coloptions = palloc_array(int16, numberOfAttributes);
 	ComputeIndexAttrs(indexInfo,
-					  typeObjectId, collationObjectId, classObjectId,
+					  typeIds, collationIds, opclassIds,
 					  coloptions, allIndexParams,
-					  stmt->excludeOpNames, relationId,
+					  stmt->excludeOpNames, tableId,
 					  accessMethodName, accessMethodId,
 					  amcanorder, stmt->isconstraint, root_save_userid,
 					  root_save_sec_context, &root_save_nestlevel);
@@ -1011,7 +1011,7 @@ DefineIndex(Oid relationId,
 					Oid			idx_opfamily;
 					Oid			idx_opcintype;
 
-					if (get_opclass_opfamily_and_input_type(classObjectId[j],
+					if (get_opclass_opfamily_and_input_type(opclassIds[j],
 															&idx_opfamily,
 															&idx_opcintype))
 					{
@@ -1181,7 +1181,7 @@ DefineIndex(Oid relationId,
 					 parentConstraintId,
 					 stmt->oldNumber, indexInfo, indexColNames,
 					 accessMethodId, tablespaceId,
-					 collationObjectId, classObjectId,
+					 collationIds, opclassIds,
 					 coloptions, reloptions,
 					 flags, constr_flags,
 					 allowSystemTableMods, !check_rights,
@@ -1262,7 +1262,7 @@ DefineIndex(Oid relationId,
 				 */
 				if (total_parts < 0)
 				{
-					List	   *children = find_all_inheritors(relationId,
+					List	   *children = find_all_inheritors(tableId,
 															   NoLock, NULL);
 
 					total_parts = list_length(children) - 1;
@@ -1674,7 +1674,7 @@ DefineIndex(Oid relationId,
 	PushActiveSnapshot(GetTransactionSnapshot());
 
 	/* Perform concurrent build of index */
-	index_concurrently_build(relationId, indexRelationId);
+	index_concurrently_build(tableId, indexRelationId);
 
 	/* we can do away with our snapshot */
 	PopActiveSnapshot();
@@ -1720,7 +1720,7 @@ DefineIndex(Oid relationId,
 	/*
 	 * Scan the index and the heap, insert any missing index entries.
 	 */
-	validate_index(relationId, indexRelationId, snapshot);
+	validate_index(tableId, indexRelationId, snapshot);
 
 	/*
 	 * Drop the reference snapshot.  We must do this before waiting out other
@@ -1855,10 +1855,10 @@ CheckPredicate(Expr *predicate)
  */
 static void
 ComputeIndexAttrs(IndexInfo *indexInfo,
-				  Oid *typeOidP,
-				  Oid *collationOidP,
-				  Oid *classOidP,
-				  int16 *colOptionP,
+				  Oid *typeOids,
+				  Oid *collationOids,
+				  Oid *opclassOids,
+				  int16 *colOptions,
 				  const List *attList,	/* list of IndexElem's */
 				  const List *exclusionOpNames,
 				  Oid relId,
@@ -1988,7 +1988,7 @@ ComputeIndexAttrs(IndexInfo *indexInfo,
 			}
 		}
 
-		typeOidP[attn] = atttype;
+		typeOids[attn] = atttype;
 
 		/*
 		 * Included columns have no collation, no opclass and no ordering
@@ -2013,9 +2013,9 @@ ComputeIndexAttrs(IndexInfo *indexInfo,
 						(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 						 errmsg("including column does not support NULLS FIRST/LAST options")));
 
-			classOidP[attn] = InvalidOid;
-			colOptionP[attn] = 0;
-			collationOidP[attn] = InvalidOid;
+			opclassOids[attn] = InvalidOid;
+			colOptions[attn] = 0;
+			collationOids[attn] = InvalidOid;
 			attn++;
 
 			continue;
@@ -2064,7 +2064,7 @@ ComputeIndexAttrs(IndexInfo *indexInfo,
 								format_type_be(atttype))));
 		}
 
-		collationOidP[attn] = attcollation;
+		collationOids[attn] = attcollation;
 
 		/*
 		 * Identify the opclass to use.  Use of ddl_userid is necessary due to
@@ -2077,7 +2077,7 @@ ComputeIndexAttrs(IndexInfo *indexInfo,
 			AtEOXact_GUC(false, *ddl_save_nestlevel);
 			SetUserIdAndSecContext(ddl_userid, ddl_sec_context);
 		}
-		classOidP[attn] = ResolveOpClass(attribute->opclass,
+		opclassOids[attn] = ResolveOpClass(attribute->opclass,
 										 atttype,
 										 accessMethodName,
 										 accessMethodId);
@@ -2132,7 +2132,7 @@ ComputeIndexAttrs(IndexInfo *indexInfo,
 			/*
 			 * Operator must be a member of the right opfamily, too
 			 */
-			opfamily = get_opclass_family(classOidP[attn]);
+			opfamily = get_opclass_family(opclassOids[attn]);
 			strat = get_op_opfamily_strategy(opid, opfamily);
 			if (strat == 0)
 			{
@@ -2170,20 +2170,20 @@ ComputeIndexAttrs(IndexInfo *indexInfo,
 		 * zero for any un-ordered index, while ordered indexes have DESC and
 		 * NULLS FIRST/LAST options.
 		 */
-		colOptionP[attn] = 0;
+		colOptions[attn] = 0;
 		if (amcanorder)
 		{
 			/* default ordering is ASC */
 			if (attribute->ordering == SORTBY_DESC)
-				colOptionP[attn] |= INDOPTION_DESC;
+				colOptions[attn] |= INDOPTION_DESC;
 			/* default null ordering is LAST for ASC, FIRST for DESC */
 			if (attribute->nulls_ordering == SORTBY_NULLS_DEFAULT)
 			{
 				if (attribute->ordering == SORTBY_DESC)
-					colOptionP[attn] |= INDOPTION_NULLS_FIRST;
+					colOptions[attn] |= INDOPTION_NULLS_FIRST;
 			}
 			else if (attribute->nulls_ordering == SORTBY_NULLS_FIRST)
-				colOptionP[attn] |= INDOPTION_NULLS_FIRST;
+				colOptions[attn] |= INDOPTION_NULLS_FIRST;
 		}
 		else
 		{
diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h
index 72ac2dc1b1..4d8ba81f90 100644
--- a/src/include/catalog/index.h
+++ b/src/include/catalog/index.h
@@ -74,10 +74,10 @@ extern Oid	index_create(Relation heapRelation,
 						 RelFileNumber relFileNumber,
 						 IndexInfo *indexInfo,
 						 const List *indexColNames,
-						 Oid accessMethodObjectId,
+						 Oid accessMethodId,
 						 Oid tableSpaceId,
-						 const Oid *collationObjectId,
-						 const Oid *classObjectId,
+						 const Oid *collationIds,
+						 const Oid *opclassIds,
 						 const int16 *coloptions,
 						 Datum reloptions,
 						 bits16 flags,
diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h
index 190040d463..179eb9901f 100644
--- a/src/include/commands/defrem.h
+++ b/src/include/commands/defrem.h
@@ -24,7 +24,7 @@
 extern void RemoveObjects(DropStmt *stmt);
 
 /* commands/indexcmds.c */
-extern ObjectAddress DefineIndex(Oid relationId,
+extern ObjectAddress DefineIndex(Oid tableId,
 								 IndexStmt *stmt,
 								 Oid indexRelationId,
 								 Oid parentIndexId,
-- 
2.41.0