@@ -336,7 +336,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
336
336
337
337
%type <str> opt_single_name
338
338
%type <list> opt_qualified_name
339
- %type <boolean> opt_concurrently
339
+ %type <boolean> opt_concurrently
340
340
%type <dbehavior> opt_drop_behavior
341
341
342
342
%type <node> alter_column_default opclass_item opclass_drop alter_using
@@ -564,7 +564,8 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
564
564
%type <defelt> generic_option_elem alter_generic_option_elem
565
565
%type <list> generic_option_list alter_generic_option_list
566
566
567
- %type <ival> reindex_target_type reindex_target_multitable reindex_name_optional
567
+ %type <ival> reindex_target_type
568
+ %type <list> opt_reindex_option_list
568
569
569
570
%type <node> copy_generic_opt_arg copy_generic_opt_arg_list_item
570
571
%type <defelt> copy_generic_opt_elem
@@ -9091,94 +9092,64 @@ DropTransformStmt: DROP TRANSFORM opt_if_exists FOR Typename LANGUAGE name opt_d
9091
9092
*
9092
9093
* QUERY:
9093
9094
*
9094
- * REINDEX [ (options) ] type [CONCURRENTLY] <name>
9095
+ * REINDEX [ (options) ] {TABLE | INDEX | SCHEMA} [CONCURRENTLY] <name>
9096
+ * REINDEX [ (options) ] DATABASE [CONCURRENTLY] [<name>]
9097
+ * REINDEX [ (options) ] SYSTEM [<name>]
9095
9098
*****************************************************************************/
9096
9099
9097
9100
ReindexStmt :
9098
- REINDEX reindex_target_type opt_concurrently qualified_name
9101
+ REINDEX opt_reindex_option_list reindex_target_type opt_concurrently qualified_name
9099
9102
{
9100
9103
ReindexStmt *n = makeNode(ReindexStmt);
9101
9104
9102
- n->kind = $2 ;
9103
- n->relation = $4 ;
9105
+ n->kind = $3 ;
9106
+ n->relation = $5 ;
9104
9107
n->name = NULL ;
9105
- n->params = NIL ;
9106
- if ($3 )
9108
+ n->params = $2 ;
9109
+ if ($4 )
9107
9110
n->params = lappend(n->params,
9108
- makeDefElem (" concurrently" , NULL , @3 ));
9111
+ makeDefElem (" concurrently" , NULL , @4 ));
9109
9112
$$ = (Node *) n;
9110
9113
}
9111
- | REINDEX reindex_target_multitable opt_concurrently name
9114
+ | REINDEX opt_reindex_option_list SCHEMA opt_concurrently name
9112
9115
{
9113
9116
ReindexStmt *n = makeNode(ReindexStmt);
9114
9117
9115
- n->kind = $2 ;
9116
- n->name = $4 ;
9118
+ n->kind = REINDEX_OBJECT_SCHEMA ;
9119
+ n->name = $5 ;
9117
9120
n->relation = NULL ;
9118
- n->params = NIL ;
9119
- if ($3 )
9121
+ n->params = $2 ;
9122
+ if ($4 )
9120
9123
n->params = lappend(n->params,
9121
- makeDefElem (" concurrently" , NULL , @3 ));
9124
+ makeDefElem (" concurrently" , NULL , @4 ));
9122
9125
$$ = (Node *) n;
9123
9126
}
9124
- | REINDEX reindex_name_optional
9125
- {
9126
- ReindexStmt *n = makeNode(ReindexStmt);
9127
- n->kind = $2 ;
9128
- n->name = NULL ;
9129
- n->relation = NULL ;
9130
- n->params = NIL;
9131
- $$ = (Node *)n;
9132
- }
9133
- | REINDEX ' (' utility_option_list ' )' reindex_name_optional
9127
+ | REINDEX opt_reindex_option_list DATABASE opt_concurrently opt_single_name
9134
9128
{
9135
9129
ReindexStmt *n = makeNode(ReindexStmt);
9136
- n->kind = $5 ;
9130
+ n->kind = REINDEX_OBJECT_DATABASE ;
9137
9131
n->name = NULL ;
9138
9132
n->relation = NULL ;
9139
- n->params = $3 ;
9140
- $$ = (Node *)n;
9141
- }
9142
- | REINDEX ' (' utility_option_list ' )' reindex_target_type opt_concurrently qualified_name
9143
- {
9144
- ReindexStmt *n = makeNode(ReindexStmt);
9145
-
9146
- n->kind = $5 ;
9147
- n->relation = $7 ;
9148
- n->name = NULL ;
9149
- n->params = $3 ;
9150
- if ($6 )
9151
- n->params = lappend(n->params,
9152
- makeDefElem (" concurrently" , NULL , @6 ));
9133
+ n->params = $2 ;
9153
9134
$$ = (Node *) n;
9154
9135
}
9155
- | REINDEX ' ( ' utility_option_list ' ) ' reindex_target_multitable opt_concurrently name
9136
+ | REINDEX opt_reindex_option_list SYSTEM_P opt_single_name
9156
9137
{
9157
9138
ReindexStmt *n = makeNode(ReindexStmt);
9158
-
9159
- n->kind = $5 ;
9160
- n->name = $7 ;
9139
+ n->kind = REINDEX_OBJECT_SYSTEM;
9140
+ n->name = NULL ;
9161
9141
n->relation = NULL ;
9162
- n->params = $3 ;
9163
- if ($6 )
9164
- n->params = lappend(n->params,
9165
- makeDefElem (" concurrently" , NULL , @6 ));
9142
+ n->params = $2 ;
9166
9143
$$ = (Node *) n;
9167
9144
}
9168
9145
;
9169
9146
reindex_target_type :
9170
9147
INDEX { $$ = REINDEX_OBJECT_INDEX; }
9171
9148
| TABLE { $$ = REINDEX_OBJECT_TABLE; }
9172
9149
;
9173
- reindex_target_multitable :
9174
- SCHEMA { $$ = REINDEX_OBJECT_SCHEMA; }
9175
- | SYSTEM_P { $$ = REINDEX_OBJECT_SYSTEM; }
9176
- | DATABASE { $$ = REINDEX_OBJECT_DATABASE; }
9177
- ;
9178
- /* For these options the name is optional */
9179
- reindex_name_optional :
9180
- SYSTEM_P { $$ = REINDEX_OBJECT_SYSTEM; }
9181
- | DATABASE { $$ = REINDEX_OBJECT_DATABASE; }
9150
+ opt_reindex_option_list :
9151
+ ' (' utility_option_list ' )' { $$ = $2 ; }
9152
+ | /* EMPTY */ { $$ = NULL ; }
9182
9153
;
9183
9154
9184
9155
/* ****************************************************************************
0 commit comments