Rearrange CLUSTER rules in gram.y.

This change moves the unparenthesized syntax for CLUSTER to the end
of the ClusterStmt rules in preparation for a follow-up commit that
will move this syntax to the "Compatibility" section of the CLUSTER
documentation.  The documentation for the CLUSTER syntaxes has also
been consolidated.

Suggested-by: Melanie Plageman
Discussion https://postgr.es/m/CAAKRu_bc5uHieG1976kGqJKxyWtyQt9yvktjsVX%2Bi7NOigDjOA%40mail.gmail.com
This commit is contained in:
Nathan Bossart 2023-07-19 15:26:43 -07:00
parent d65ddaca93
commit 018b61f81b
2 changed files with 15 additions and 17 deletions

View File

@ -21,9 +21,8 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
CLUSTER [VERBOSE] <replaceable class="parameter">table_name</replaceable> [ USING <replaceable class="parameter">index_name</replaceable> ]
CLUSTER ( <replaceable class="parameter">option</replaceable> [, ...] ) <replaceable class="parameter">table_name</replaceable> [ USING <replaceable class="parameter">index_name</replaceable> ]
CLUSTER [VERBOSE]
CLUSTER [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] <replaceable class="parameter">table_name</replaceable> [ USING <replaceable class="parameter">index_name</replaceable> ]
CLUSTER [ VERBOSE ] [ <replaceable class="parameter">table_name</replaceable> [ USING <replaceable class="parameter">index_name</replaceable> ] ]
<phrase>where <replaceable class="parameter">option</replaceable> can be one of:</phrase>

View File

@ -11553,15 +11553,24 @@ CreateConversionStmt:
/*****************************************************************************
*
* QUERY:
* CLUSTER [VERBOSE] <qualified_name> [ USING <index_name> ]
* CLUSTER [ (options) ] <qualified_name> [ USING <index_name> ]
* CLUSTER [VERBOSE]
* CLUSTER (options) <qualified_name> [ USING <index_name> ]
* CLUSTER [VERBOSE] [ <qualified_name> [ USING <index_name> ] ]
* CLUSTER [VERBOSE] <index_name> ON <qualified_name> (for pre-8.3)
*
*****************************************************************************/
ClusterStmt:
CLUSTER opt_verbose qualified_name cluster_index_specification
CLUSTER '(' utility_option_list ')' qualified_name cluster_index_specification
{
ClusterStmt *n = makeNode(ClusterStmt);
n->relation = $5;
n->indexname = $6;
n->params = $3;
$$ = (Node *) n;
}
/* unparenthesized VERBOSE kept for pre-14 compatibility */
| CLUSTER opt_verbose qualified_name cluster_index_specification
{
ClusterStmt *n = makeNode(ClusterStmt);
@ -11572,16 +11581,6 @@ ClusterStmt:
n->params = lappend(n->params, makeDefElem("verbose", NULL, @2));
$$ = (Node *) n;
}
| CLUSTER '(' utility_option_list ')' qualified_name cluster_index_specification
{
ClusterStmt *n = makeNode(ClusterStmt);
n->relation = $5;
n->indexname = $6;
n->params = $3;
$$ = (Node *) n;
}
| CLUSTER opt_verbose
{
ClusterStmt *n = makeNode(ClusterStmt);