Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit cdaedfc

Browse files
Support parenthesized syntax for CLUSTER without a table name.
b5913f6 added a parenthesized syntax for CLUSTER, but it requires specifying a table name. This is unlike commands such as VACUUM and ANALYZE, which do not require specifying a table in the parenthesized syntax. This change resolves this inconsistency. This is preparatory work for a follow-up commit that will move the unparenthesized syntax to the "Compatibility" section of the CLUSTER documentation. Reviewed-by: Melanie Plageman, Michael Paquier Discussion: https://postgr.es/m/CAAKRu_bc5uHieG1976kGqJKxyWtyQt9yvktjsVX%2Bi7NOigDjOA%40mail.gmail.com
1 parent 018b61f commit cdaedfc

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

doc/src/sgml/ref/cluster.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ PostgreSQL documentation
2121

2222
<refsynopsisdiv>
2323
<synopsis>
24-
CLUSTER [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] <replaceable class="parameter">table_name</replaceable> [ USING <replaceable class="parameter">index_name</replaceable> ]
24+
CLUSTER [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] [ <replaceable class="parameter">table_name</replaceable> [ USING <replaceable class="parameter">index_name</replaceable> ] ]
2525
CLUSTER [ VERBOSE ] [ <replaceable class="parameter">table_name</replaceable> [ USING <replaceable class="parameter">index_name</replaceable> ] ]
2626

2727
<phrase>where <replaceable class="parameter">option</replaceable> can be one of:</phrase>

src/backend/parser/gram.y

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11553,7 +11553,7 @@ CreateConversionStmt:
1155311553
/*****************************************************************************
1155411554
*
1155511555
* QUERY:
11556-
* CLUSTER (options) <qualified_name> [ USING <index_name> ]
11556+
* CLUSTER (options) [ <qualified_name> [ USING <index_name> ] ]
1155711557
* CLUSTER [VERBOSE] [ <qualified_name> [ USING <index_name> ] ]
1155811558
* CLUSTER [VERBOSE] <index_name> ON <qualified_name> (for pre-8.3)
1155911559
*
@@ -11569,6 +11569,15 @@ ClusterStmt:
1156911569
n->params = $3;
1157011570
$$ = (Node *) n;
1157111571
}
11572+
| CLUSTER '(' utility_option_list ')'
11573+
{
11574+
ClusterStmt *n = makeNode(ClusterStmt);
11575+
11576+
n->relation = NULL;
11577+
n->indexname = NULL;
11578+
n->params = $3;
11579+
$$ = (Node *) n;
11580+
}
1157211581
/* unparenthesized VERBOSE kept for pre-14 compatibility */
1157311582
| CLUSTER opt_verbose qualified_name cluster_index_specification
1157411583
{
@@ -11581,6 +11590,7 @@ ClusterStmt:
1158111590
n->params = lappend(n->params, makeDefElem("verbose", NULL, @2));
1158211591
$$ = (Node *) n;
1158311592
}
11593+
/* unparenthesized VERBOSE kept for pre-17 compatibility */
1158411594
| CLUSTER opt_verbose
1158511595
{
1158611596
ClusterStmt *n = makeNode(ClusterStmt);

0 commit comments

Comments
 (0)