0003-Some-vertical-reformatting.patch

text/plain

Filename: 0003-Some-vertical-reformatting.patch
Type: text/plain
Part: 2
Message: some code cleanup in index.c and indexcmds.c

Patch

Format: format-patch
Series: patch 0003
Subject: Some vertical reformatting
File+
src/backend/catalog/index.c 4 8
src/backend/commands/indexcmds.c 8 13
From e5260923d204707172928c4dc9389042177677b9 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Wed, 16 Aug 2023 07:45:28 +0200
Subject: [PATCH 3/3] Some vertical reformatting

Remove some line breaks that have become unnecessary after some
variable renaming.
---
 src/backend/catalog/index.c      | 12 ++++--------
 src/backend/commands/indexcmds.c | 21 ++++++++-------------
 2 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 05b6f9ca1a..fd09378848 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -329,8 +329,7 @@ ConstructTupleDescriptor(Relation heapRelation,
 		to->attstattarget = -1;
 		to->attcacheoff = -1;
 		to->attislocal = true;
-		to->attcollation = (i < numkeyatts) ?
-			collationIds[i] : InvalidOid;
+		to->attcollation = (i < numkeyatts) ? collationIds[i] : InvalidOid;
 
 		/*
 		 * Set the attribute name as specified by caller.
@@ -438,8 +437,7 @@ ConstructTupleDescriptor(Relation heapRelation,
 		{
 			tuple = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclassIds[i]));
 			if (!HeapTupleIsValid(tuple))
-				elog(ERROR, "cache lookup failed for opclass %u",
-					 opclassIds[i]);
+				elog(ERROR, "cache lookup failed for opclass %u", opclassIds[i]);
 			opclassTup = (Form_pg_opclass) GETSTRUCT(tuple);
 			if (OidIsValid(opclassTup->opckeytype))
 				keyType = opclassTup->opckeytype;
@@ -1159,11 +1157,9 @@ 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(collationIds[i]) &&
-				collationIds[i] != DEFAULT_COLLATION_OID)
+			if (OidIsValid(collationIds[i]) && collationIds[i] != DEFAULT_COLLATION_OID)
 			{
-				ObjectAddressSet(referenced, CollationRelationId,
-								 collationIds[i]);
+				ObjectAddressSet(referenced, CollationRelationId, collationIds[i]);
 				add_exact_object_address(&referenced, addrs);
 			}
 		}
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index 0ed620ef65..483b868785 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -81,7 +81,8 @@ static void ComputeIndexAttrs(IndexInfo *indexInfo,
 							  const List *attList,
 							  const List *exclusionOpNames,
 							  Oid relId,
-							  const char *accessMethodName, Oid accessMethodId,
+							  const char *accessMethodName,
+							  Oid accessMethodId,
 							  bool amcanorder,
 							  bool isconstraint,
 							  Oid ddl_userid,
@@ -274,10 +275,8 @@ CheckIndexCompatible(Oid oldId,
 	d = SysCacheGetAttrNotNull(INDEXRELID, tuple, Anum_pg_index_indclass);
 	old_indclass = (oidvector *) DatumGetPointer(d);
 
-	ret = (memcmp(old_indclass->values, opclassIds,
-				  old_natts * sizeof(Oid)) == 0 &&
-		   memcmp(old_indcollation->values, collationIds,
-				  old_natts * sizeof(Oid)) == 0);
+	ret = (memcmp(old_indclass->values, opclassIds, old_natts * sizeof(Oid)) == 0 &&
+		   memcmp(old_indcollation->values, collationIds, old_natts * sizeof(Oid)) == 0);
 
 	ReleaseSysCache(tuple);
 
@@ -603,8 +602,7 @@ DefineIndex(Oid tableId,
 	 */
 	if (!OidIsValid(parentIndexId))
 	{
-		pgstat_progress_start_command(PROGRESS_COMMAND_CREATE_INDEX,
-									  tableId);
+		pgstat_progress_start_command(PROGRESS_COMMAND_CREATE_INDEX, tableId);
 		pgstat_progress_update_param(PROGRESS_CREATEIDX_COMMAND,
 									 concurrent ?
 									 PROGRESS_CREATEIDX_COMMAND_CREATE_CONCURRENTLY :
@@ -1262,8 +1260,7 @@ DefineIndex(Oid tableId,
 				 */
 				if (total_parts < 0)
 				{
-					List	   *children = find_all_inheritors(tableId,
-															   NoLock, NULL);
+					List	   *children = find_all_inheritors(tableId, NoLock, NULL);
 
 					total_parts = list_length(children) - 1;
 					list_free(children);
@@ -3789,8 +3786,7 @@ ReindexRelationConcurrently(Oid relationOid, const ReindexParams *params)
 		if (indexRel->rd_rel->relpersistence == RELPERSISTENCE_TEMP)
 			elog(ERROR, "cannot reindex a temporary table concurrently");
 
-		pgstat_progress_start_command(PROGRESS_COMMAND_CREATE_INDEX,
-									  idx->tableId);
+		pgstat_progress_start_command(PROGRESS_COMMAND_CREATE_INDEX, idx->tableId);
 
 		progress_vals[0] = PROGRESS_CREATEIDX_COMMAND_REINDEX_CONCURRENTLY;
 		progress_vals[1] = 0;	/* initializing */
@@ -4015,8 +4011,7 @@ ReindexRelationConcurrently(Oid relationOid, const ReindexParams *params)
 		 * Update progress for the index to build, with the correct parent
 		 * table involved.
 		 */
-		pgstat_progress_start_command(PROGRESS_COMMAND_CREATE_INDEX,
-									  newidx->tableId);
+		pgstat_progress_start_command(PROGRESS_COMMAND_CREATE_INDEX, newidx->tableId);
 		progress_vals[0] = PROGRESS_CREATEIDX_COMMAND_REINDEX_CONCURRENTLY;
 		progress_vals[1] = PROGRESS_CREATEIDX_PHASE_VALIDATE_IDXSCAN;
 		progress_vals[2] = newidx->indexId;
-- 
2.41.0