v10-0001-minor-indentation-fix.no-cfbot

application/octet-stream

Filename: v10-0001-minor-indentation-fix.no-cfbot
Type: application/octet-stream
Part: 0
Message: Re: Proposal to Enable/Disable Index using ALTER INDEX (with patch)
From a341f8abf77df8ea9befb278b82c8537a1e4b4f4 Mon Sep 17 00:00:00 2001
From: jian he <jian.universality@gmail.com>
Date: Mon, 3 Feb 2025 10:43:31 +0800
Subject: [PATCH v10 1/1] minor indentation fix

---
 src/backend/catalog/index.c                          | 2 +-
 src/backend/commands/tablecmds.c                     | 4 ++--
 src/backend/parser/gram.y                            | 2 +-
 src/include/catalog/index.h                          | 2 +-
 src/include/nodes/parsenodes.h                       | 6 +++---
 src/test/modules/test_ddl_deparse/test_ddl_deparse.c | 6 ++++++
 6 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index ef51e6de0b..68aece185e 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -1455,7 +1455,7 @@ index_concurrently_create_copy(Relation heapRelation, Oid oldIndexId,
 	*/
 	createFlags = INDEX_CREATE_SKIP_BUILD | INDEX_CREATE_CONCURRENT;
 	if (indexForm->indisvisible)
-			createFlags |= INDEX_CREATE_VISIBLE;
+		createFlags |= INDEX_CREATE_VISIBLE;
 
 	/*
 	 * Now create the new index.
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 254144e5cb..ba70fde178 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -21096,9 +21096,9 @@ ATExecSetIndexVisibility(Relation rel, bool visible)
 	indexForm = (Form_pg_index) GETSTRUCT(indexTuple);
 	if (indexForm->indcheckxmin)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				errmsg("cannot update index visibility while indcheckxmin is true"),
-				errhint("Wait for all transactions that might see inconsistent HOT chains to complete")));
+				errhint("Wait for all transactions that might see inconsistent HOT chains to complete"));
 
 	if (indexForm->indisvisible != visible)
 	{
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 475ee26036..d4dfb9ca52 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -8266,7 +8266,7 @@ opt_unique:
 		;
 
 opt_index_visibility:
-			VISIBLE_P                      { $$ = true; }
+			VISIBLE_P                       { $$ = true; }
 			| INVISIBLE_P                   { $$ = false; }
 			| /*EMPTY*/                 	{ $$ = true; }
 		;
diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h
index ff0f9916de..7edde3078f 100644
--- a/src/include/catalog/index.h
+++ b/src/include/catalog/index.h
@@ -65,7 +65,7 @@ extern void index_check_primary_key(Relation heapRel,
 #define	INDEX_CREATE_IF_NOT_EXISTS			(1 << 4)
 #define	INDEX_CREATE_PARTITIONED			(1 << 5)
 #define INDEX_CREATE_INVALID				(1 << 6)
-#define INDEX_CREATE_VISIBLE        (1 << 7)
+#define INDEX_CREATE_VISIBLE        		(1 << 7)
 
 extern Oid	index_create(Relation heapRelation,
 						 const char *indexRelationName,
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index e9553d0f24..5c43cf074f 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -2467,8 +2467,8 @@ typedef enum AlterTableType
 	AT_SetIdentity,				/* SET identity column options */
 	AT_DropIdentity,			/* DROP IDENTITY */
 	AT_ReAddStatistics,			/* internal to commands/tablecmds.c */
-	AT_SetIndexVisible,					/* Set INDEX visible */
-	AT_SetIndexInvisible,				/* Set INDEX invisible */
+	AT_SetIndexVisible,			/* Set INDEX visible */
+	AT_SetIndexInvisible,		/* Set INDEX invisible */
 } AlterTableType;
 
 typedef struct ReplicaIdentityStmt
@@ -3451,7 +3451,7 @@ typedef struct IndexStmt
 	bool		if_not_exists;	/* just do nothing if index already exists? */
 	bool		reset_default_tblspc;	/* reset default_tablespace prior to
 										 * executing */
-  bool		isvisible;		/* true if VISIBLE (default), false if INVISIBLE */
+	bool		isvisible;		/* true if VISIBLE (default), false if INVISIBLE */
 } IndexStmt;
 
 /* ----------------------
diff --git a/src/test/modules/test_ddl_deparse/test_ddl_deparse.c b/src/test/modules/test_ddl_deparse/test_ddl_deparse.c
index 193669f2bc..8d7c7e5894 100644
--- a/src/test/modules/test_ddl_deparse/test_ddl_deparse.c
+++ b/src/test/modules/test_ddl_deparse/test_ddl_deparse.c
@@ -308,6 +308,12 @@ get_altertable_subcmdinfo(PG_FUNCTION_ARGS)
 			case AT_ReAddStatistics:
 				strtype = "(re) ADD STATS";
 				break;
+			case AT_SetIndexVisible:
+				strtype = "SET VISIBLE";
+				break;
+			case AT_SetIndexInvisible:
+				strtype = "SET INVISIBLE";
+				break;
 		}
 
 		if (subcmd->recurse)
-- 
2.34.1