@@ -336,7 +336,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
336336
337337%type <str> opt_single_name
338338%type <list> opt_qualified_name
339- %type <boolean> opt_concurrently
339+ %type <boolean> opt_concurrently
340340%type <dbehavior> opt_drop_behavior
341341
342342%type <node> alter_column_default opclass_item opclass_drop alter_using
@@ -564,7 +564,8 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
564564%type <defelt> generic_option_elem alter_generic_option_elem
565565%type <list> generic_option_list alter_generic_option_list
566566
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
568569
569570%type <node> copy_generic_opt_arg copy_generic_opt_arg_list_item
570571%type <defelt> copy_generic_opt_elem
@@ -9091,94 +9092,64 @@ DropTransformStmt: DROP TRANSFORM opt_if_exists FOR Typename LANGUAGE name opt_d
90919092 *
90929093 *QUERY:
90939094 *
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>]
90959098 *****************************************************************************/
90969099
90979100ReindexStmt :
9098- REINDEX reindex_target_type opt_concurrently qualified_name
9101+ REINDEX opt_reindex_option_list reindex_target_type opt_concurrently qualified_name
90999102{
91009103ReindexStmt *n = makeNode(ReindexStmt);
91019104
9102- n->kind =$2 ;
9103- n->relation =$4 ;
9105+ n->kind =$3 ;
9106+ n->relation =$5 ;
91049107n->name =NULL ;
9105- n->params =NIL ;
9106- if ($3 )
9108+ n->params =$2 ;
9109+ if ($4 )
91079110n->params = lappend(n->params,
9108- makeDefElem (" concurrently" ,NULL , @3 ));
9111+ makeDefElem (" concurrently" ,NULL , @4 ));
91099112$$ = (Node *) n;
91109113}
9111- | REINDEX reindex_target_multitable opt_concurrently name
9114+ | REINDEX opt_reindex_option_list SCHEMA opt_concurrently name
91129115{
91139116ReindexStmt *n = makeNode(ReindexStmt);
91149117
9115- n->kind =$2 ;
9116- n->name =$4 ;
9118+ n->kind =REINDEX_OBJECT_SCHEMA ;
9119+ n->name =$5 ;
91179120n->relation =NULL ;
9118- n->params =NIL ;
9119- if ($3 )
9121+ n->params =$2 ;
9122+ if ($4 )
91209123n->params = lappend(n->params,
9121- makeDefElem (" concurrently" ,NULL , @3 ));
9124+ makeDefElem (" concurrently" ,NULL , @4 ));
91229125$$ = (Node *) n;
91239126}
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
91349128{
91359129ReindexStmt *n = makeNode(ReindexStmt);
9136- n->kind =$5 ;
9130+ n->kind =REINDEX_OBJECT_DATABASE ;
91379131n->name =NULL ;
91389132n->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 ;
91539134$$ = (Node *) n;
91549135}
9155- | REINDEX ' ( ' utility_option_list ' ) ' reindex_target_multitable opt_concurrently name
9136+ | REINDEX opt_reindex_option_list SYSTEM_P opt_single_name
91569137{
91579138ReindexStmt *n = makeNode(ReindexStmt);
9158-
9159- n->kind =$5 ;
9160- n->name =$7 ;
9139+ n->kind = REINDEX_OBJECT_SYSTEM;
9140+ n->name =NULL ;
91619141n->relation =NULL ;
9162- n->params =$3 ;
9163- if ($6 )
9164- n->params = lappend(n->params,
9165- makeDefElem (" concurrently" ,NULL , @6 ));
9142+ n->params =$2 ;
91669143$$ = (Node *) n;
91679144}
91689145;
91699146reindex_target_type :
91709147INDEX {$$ = REINDEX_OBJECT_INDEX; }
91719148| TABLE {$$ = REINDEX_OBJECT_TABLE; }
91729149;
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 ; }
91829153;
91839154
91849155/* ****************************************************************************