@@ -33,12 +33,12 @@ use super::{
3333 Assignment , AssignmentTarget , AttachedToken , BeginEndStatements , CaseStatement , CloseCursor ,
3434 ClusteredIndex , ColumnDef , ColumnOption , ColumnOptionDef , ConditionalStatementBlock ,
3535 ConditionalStatements , ConflictTarget , ConnectByKind , ConstraintCharacteristics , CopySource ,
36- CreateIndex , CreateRule , CreateRuleAction , CreateTable , CreateTableOptions , Cte , Delete ,
37- DoUpdate , ExceptSelectItem , ExcludeConstraintElement , ExcludeSelectItem , Expr , ExprWithAlias ,
38- Fetch , ForValues , FromTable , Function , FunctionArg , FunctionArgExpr , FunctionArgumentClause ,
39- FunctionArgumentList , FunctionArguments , GroupByExpr , HavingBound , IfStatement ,
40- IlikeSelectItem , InTarget , IndexColumn , Insert , Interpolate , InterpolateExpr , Join ,
41- JoinConstraint , JoinOperator , JsonPath , JsonPathElem , LateralView , LimitClause ,
36+ CreateIndex , CreateRule , CreateRuleAction , CreateTable , CreateTableOptions , CreateUserMapping ,
37+ Cte , Delete , DoUpdate , ExceptSelectItem , ExcludeConstraintElement , ExcludeSelectItem , Expr ,
38+ ExprWithAlias , Fetch , ForValues , FromTable , Function , FunctionArg , FunctionArgExpr ,
39+ FunctionArgumentClause , FunctionArgumentList , FunctionArguments , GroupByExpr , HavingBound ,
40+ IfStatement , IlikeSelectItem , InTarget , IndexColumn , Insert , Interpolate , InterpolateExpr ,
41+ Join , JoinConstraint , JoinOperator , JsonPath , JsonPathElem , LateralView , LimitClause ,
4242 MatchRecognizePattern , Measure , Merge , MergeAction , MergeClause , MergeInsertExpr ,
4343 MergeInsertKind , MergeUpdateExpr , MergeUpdateKind , NamedParenthesizedList ,
4444 NamedWindowDefinition , ObjectName , ObjectNamePart , Offset , OnConflict , OnConflictAction ,
@@ -47,8 +47,9 @@ use super::{
4747 RaiseStatement , RaiseStatementValue , ReferentialAction , RenameSelectItem , ReplaceSelectElement ,
4848 ReplaceSelectItem , Select , SelectInto , SelectItem , SetExpr , Setting , SqlOption , Statement ,
4949 Subscript , SymbolDefinition , TableAlias , TableAliasColumnDef , TableConstraint , TableFactor ,
50- TableObject , TableOptionsClustered , TableWithJoins , Update , UpdateTableFromKind , Use , Values ,
51- ViewColumnDef , WhileStatement , WildcardAdditionalOptions , With , WithFill ,
50+ TableObject , TableOptionsClustered , TableWithJoins , Update , UpdateTableFromKind , Use ,
51+ UserMappingUser , Values , ViewColumnDef , WhileStatement , WildcardAdditionalOptions , With ,
52+ WithFill ,
5253} ;
5354
5455/// Given an iterator of spans, return the [Span::union] of all spans.
@@ -399,6 +400,7 @@ impl Spanned for Statement {
399400 Statement :: CreateServer { .. } => Span :: empty ( ) ,
400401 Statement :: CreateForeignTable ( stmt) => stmt. span ( ) ,
401402 Statement :: CreateForeignDataWrapper ( stmt) => stmt. span ( ) ,
403+ Statement :: CreateUserMapping ( stmt) => stmt. span ( ) ,
402404 Statement :: CreateConnector { .. } => Span :: empty ( ) ,
403405 Statement :: CreateOperator ( create_operator) => create_operator. span ( ) ,
404406 Statement :: CreateOperatorFamily ( create_operator_family) => {
@@ -2777,6 +2779,23 @@ impl Spanned for comments::CommentWithSpan {
27772779 }
27782780}
27792781
2782+ impl Spanned for CreateUserMapping {
2783+ fn span ( & self ) -> Span {
2784+ let user = match & self . user {
2785+ UserMappingUser :: Name ( name) => name. span ,
2786+ _ => Span :: empty ( ) ,
2787+ } ;
2788+ Span :: union_iter (
2789+ [ user, self . server_name . span ] . into_iter ( ) . chain (
2790+ self . options
2791+ . iter ( )
2792+ . flatten ( )
2793+ . flat_map ( |option| [ option. key . span , option. value . span ] ) ,
2794+ ) ,
2795+ )
2796+ }
2797+ }
2798+
27802799#[ cfg( test) ]
27812800pub mod tests {
27822801 use crate :: ast:: Value ;
0 commit comments