@@ -29,27 +29,27 @@ use crate::tokenizer::Span;
2929
3030use super :: {
3131 comments, dcl:: SecondaryRoles , value:: ValueWithSpan , AccessExpr , AlterColumnOperation ,
32- AlterGenericOption , AlterIndexOperation , AlterTableOperation , AlterTrigger ,
33- AlterTriggerOperation , Analyze , Array , Assignment , AssignmentTarget , AttachedToken ,
34- BeginEndStatements , CaseStatement , CloseCursor , ClusteredIndex , ColumnDef , ColumnOption ,
35- ColumnOptionDef , ConditionalStatementBlock , ConditionalStatements , ConflictTarget ,
36- ConnectByKind , ConstraintCharacteristics , CopySource , CreateIndex , CreateRule ,
37- CreateRuleAction , CreateTable , CreateTableOptions , Cte , Delete , DoUpdate , ExceptSelectItem ,
38- ExcludeConstraintElement , ExcludeSelectItem , Expr , ExprWithAlias , Fetch , ForValues , FromTable ,
39- Function , FunctionArg , FunctionArgExpr , FunctionArgumentClause , FunctionArgumentList ,
40- FunctionArguments , GroupByExpr , HavingBound , IfStatement , IlikeSelectItem , InTarget ,
41- IndexColumn , Insert , Interpolate , InterpolateExpr , Join , JoinConstraint , JoinOperator ,
42- JsonPath , JsonPathElem , LateralView , LimitClause , MatchRecognizePattern , Measure , Merge ,
43- MergeAction , MergeClause , MergeInsertExpr , MergeInsertKind , MergeUpdateExpr , MergeUpdateKind ,
44- NamedParenthesizedList , NamedWindowDefinition , ObjectName , ObjectNamePart , Offset , OnConflict ,
45- OnConflictAction , OnInsert , OpenStatement , OperateFunctionArg , OrderBy , OrderByExpr ,
46- OrderByKind , OutputClause , Parens , Partition , PartitionBoundValue , PivotValueSource ,
47- ProjectionSelect , Query , RaiseStatement , RaiseStatementValue , ReferentialAction ,
48- RenameSelectItem , ReplaceSelectElement , ReplaceSelectItem , Select , SelectInto , SelectItem ,
49- SetExpr , Setting , SqlOption , Statement , Subscript , SymbolDefinition , TableAlias ,
50- TableAliasColumnDef , TableConstraint , TableFactor , TableObject , TableOptionsClustered ,
51- TableWithJoins , Update , UpdateTableFromKind , Use , Values , ViewColumnDef , WhileStatement ,
52- WildcardAdditionalOptions , With , WithFill ,
32+ AlterGenericOption , AlterIndexOperation , AlterServer , AlterServerOperation ,
33+ AlterTableOperation , AlterTrigger , AlterTriggerOperation , Analyze , Array , Assignment ,
34+ AssignmentTarget , AttachedToken , BeginEndStatements , CaseStatement , CloseCursor ,
35+ ClusteredIndex , ColumnDef , ColumnOption , ColumnOptionDef , ConditionalStatementBlock ,
36+ ConditionalStatements , ConflictTarget , ConnectByKind , ConstraintCharacteristics , CopySource ,
37+ CreateIndex , CreateRule , CreateRuleAction , CreateTable , CreateTableOptions , Cte , Delete ,
38+ DoUpdate , ExceptSelectItem , ExcludeConstraintElement , ExcludeSelectItem , Expr , ExprWithAlias ,
39+ Fetch , ForValues , FromTable , Function , FunctionArg , FunctionArgExpr , FunctionArgumentClause ,
40+ FunctionArgumentList , FunctionArguments , GroupByExpr , HavingBound , IfStatement ,
41+ IlikeSelectItem , InTarget , IndexColumn , Insert , Interpolate , InterpolateExpr , Join ,
42+ JoinConstraint , JoinOperator , JsonPath , JsonPathElem , LateralView , LimitClause ,
43+ MatchRecognizePattern , Measure , Merge , MergeAction , MergeClause , MergeInsertExpr ,
44+ MergeInsertKind , MergeUpdateExpr , MergeUpdateKind , NamedParenthesizedList ,
45+ NamedWindowDefinition , ObjectName , ObjectNamePart , Offset , OnConflict , OnConflictAction ,
46+ OnInsert , OpenStatement , OperateFunctionArg , OrderBy , OrderByExpr , OrderByKind , OutputClause ,
47+ Parens , Partition , PartitionBoundValue , PivotValueSource , ProjectionSelect , Query ,
48+ RaiseStatement , RaiseStatementValue , ReferentialAction , RenameSelectItem , ReplaceSelectElement ,
49+ ReplaceSelectItem , Select , SelectInto , SelectItem , SetExpr , Setting , SqlOption , Statement ,
50+ Subscript , SymbolDefinition , TableAlias , TableAliasColumnDef , TableConstraint , TableFactor ,
51+ TableObject , TableOptionsClustered , TableWithJoins , Update , UpdateTableFromKind , Use , Values ,
52+ ViewColumnDef , WhileStatement , WildcardAdditionalOptions , With , WithFill ,
5353} ;
5454
5555/// Given an iterator of spans, return the [Span::union] of all spans.
@@ -422,6 +422,7 @@ impl Spanned for Statement {
422422 Statement :: AlterFunction { .. } => Span :: empty ( ) ,
423423 Statement :: AlterType { .. } => Span :: empty ( ) ,
424424 Statement :: AlterCollation { .. } => Span :: empty ( ) ,
425+ Statement :: AlterServer ( alter_server) => alter_server. span ( ) ,
425426 Statement :: AlterOperator { .. } => Span :: empty ( ) ,
426427 Statement :: AlterOperatorFamily { .. } => Span :: empty ( ) ,
427428 Statement :: AlterOperatorClass { .. } => Span :: empty ( ) ,
@@ -2783,6 +2784,23 @@ impl Spanned for comments::CommentWithSpan {
27832784 }
27842785}
27852786
2787+ impl Spanned for AlterServer {
2788+ fn span ( & self ) -> Span {
2789+ let operation = match & self . operation {
2790+ AlterServerOperation :: Update { version, options } => Span :: union_iter (
2791+ version
2792+ . iter ( )
2793+ . map ( |version| version. span )
2794+ . chain ( options. iter ( ) . flatten ( ) . map ( |option| option. span ( ) ) ) ,
2795+ ) ,
2796+ AlterServerOperation :: OwnerTo ( Owner :: Ident ( owner) ) => owner. span ,
2797+ AlterServerOperation :: OwnerTo ( _) => Span :: empty ( ) ,
2798+ AlterServerOperation :: RenameTo { new_name } => new_name. span ,
2799+ } ;
2800+ self . name . span . union ( & operation)
2801+ }
2802+ }
2803+
27862804#[ cfg( test) ]
27872805pub mod tests {
27882806 use crate :: ast:: Value ;
0 commit comments