From 0e131e17ec8577a36cb307be31549c651d3b2fd6 Mon Sep 17 00:00:00 2001
From: Alexey Kondratov <kondratov.aleksey@gmail.com>
Date: Wed, 2 Sep 2020 13:36:03 +0300
Subject: [PATCH v24 2/7] Allow either new or old option syntax for CLUSTER and
 clean up its doc

---
 doc/src/sgml/ref/cluster.sgml |  1 -
 src/backend/parser/gram.y     | 10 ++++------
 src/bin/psql/tab-complete.c   |  3 +--
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/doc/src/sgml/ref/cluster.sgml b/doc/src/sgml/ref/cluster.sgml
index 110fb3083e..e6ebce27e6 100644
--- a/doc/src/sgml/ref/cluster.sgml
+++ b/doc/src/sgml/ref/cluster.sgml
@@ -91,7 +91,6 @@ CLUSTER [VERBOSE] [ ( <replaceable class="parameter">option</replaceable> [, ...
     <listitem>
      <para>
       Prints a progress report as each table is clustered.
-<!-- When specified within parenthesis, <literal>VERBOSE</literal> may be followed by a boolean ...-->
      </para>
     </listitem>
    </varlistentry>
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index b909b161a6..c5be94af45 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -10391,14 +10391,12 @@ ClusterStmt:
 					$$ = (Node*)n;
 				}
 
-			| CLUSTER opt_verbose '(' vac_analyze_option_list ')' qualified_name cluster_index_specification
+			| CLUSTER '(' vac_analyze_option_list ')' qualified_name cluster_index_specification
 				{
 					ClusterStmt *n = makeNode(ClusterStmt);
-					n->relation = $6;
-					n->indexname = $7;
-					if ($2)
-						n->options |= CLUOPT_VERBOSE;
-					n->params = $4;
+					n->relation = $5;
+					n->indexname = $6;
+					n->params = $3;
 					$$ = (Node*)n;
 				}
 			| CLUSTER opt_verbose
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index de85772ff9..245919aead 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2260,8 +2260,7 @@ psql_completion(const char *text, int start, int end)
 	else if (Matches("CLUSTER"))
 		COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_clusterables, "UNION SELECT 'VERBOSE'");
 	else if (Matches("CLUSTER", "VERBOSE") ||
-			Matches("CLUSTER", "VERBOSE", "(*)") ||
-			Matches("CLUSTER", "(*)"))
+			 Matches("CLUSTER", "(*)"))
 		COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_clusterables, NULL);
 	/* If we have CLUSTER <sth>, then add "USING" */
 	else if (Matches("CLUSTER", MatchAnyExcept("VERBOSE|ON|(|(*)")))
-- 
2.19.1

