@@ -34,19 +34,20 @@ use super::{
3434 ColumnOption , ColumnOptionDef , ConditionalStatementBlock , ConditionalStatements ,
3535 ConflictTarget , ConnectBy , ConstraintCharacteristics , CopySource , CreateIndex , CreateTable ,
3636 CreateTableOptions , Cte , Delete , DoUpdate , ExceptSelectItem , ExcludeSelectItem , Expr ,
37- ExprWithAlias , Fetch , FromTable , Function , FunctionArg , FunctionArgExpr ,
37+ ExprWithAlias , Fetch , ForValues , FromTable , Function , FunctionArg , FunctionArgExpr ,
3838 FunctionArgumentClause , FunctionArgumentList , FunctionArguments , GroupByExpr , HavingBound ,
3939 IfStatement , IlikeSelectItem , IndexColumn , Insert , Interpolate , InterpolateExpr , Join ,
4040 JoinConstraint , JoinOperator , JsonPath , JsonPathElem , LateralView , LimitClause ,
4141 MatchRecognizePattern , Measure , Merge , MergeAction , MergeClause , MergeInsertExpr ,
4242 MergeInsertKind , MergeUpdateExpr , NamedParenthesizedList , NamedWindowDefinition , ObjectName ,
4343 ObjectNamePart , Offset , OnConflict , OnConflictAction , OnInsert , OpenStatement , OrderBy ,
44- OrderByExpr , OrderByKind , OutputClause , Partition , PivotValueSource , ProjectionSelect , Query ,
45- RaiseStatement , RaiseStatementValue , ReferentialAction , RenameSelectItem , ReplaceSelectElement ,
46- ReplaceSelectItem , Select , SelectInto , SelectItem , SetExpr , SqlOption , Statement , Subscript ,
47- SymbolDefinition , TableAlias , TableAliasColumnDef , TableConstraint , TableFactor , TableObject ,
48- TableOptionsClustered , TableWithJoins , Update , UpdateTableFromKind , Use , Value , Values ,
49- ViewColumnDef , WhileStatement , WildcardAdditionalOptions , With , WithFill ,
44+ OrderByExpr , OrderByKind , OutputClause , Partition , PartitionBoundValue , PivotValueSource ,
45+ ProjectionSelect , Query , RaiseStatement , RaiseStatementValue , ReferentialAction ,
46+ RenameSelectItem , ReplaceSelectElement , ReplaceSelectItem , Select , SelectInto , SelectItem ,
47+ SetExpr , SqlOption , Statement , Subscript , SymbolDefinition , TableAlias , TableAliasColumnDef ,
48+ TableConstraint , TableFactor , TableObject , TableOptionsClustered , TableWithJoins , Update ,
49+ UpdateTableFromKind , Use , Value , Values , ViewColumnDef , WhileStatement ,
50+ WildcardAdditionalOptions , With , WithFill ,
5051} ;
5152
5253/// Given an iterator of spans, return the [Span::union] of all spans.
@@ -554,8 +555,8 @@ impl Spanned for CreateTable {
554555 cluster_by : _, // todo, BigQuery specific
555556 clustered_by : _, // todo, Hive specific
556557 inherits : _, // todo, PostgreSQL specific
557- partition_of : _ , // todo, PostgreSQL specific
558- for_values : _ , // todo, PostgreSQL specific
558+ partition_of,
559+ for_values,
559560 strict : _, // bool
560561 copy_grants : _, // bool
561562 enable_schema_evolution : _, // bool
@@ -586,7 +587,9 @@ impl Spanned for CreateTable {
586587 . chain ( columns. iter ( ) . map ( |i| i. span ( ) ) )
587588 . chain ( constraints. iter ( ) . map ( |i| i. span ( ) ) )
588589 . chain ( query. iter ( ) . map ( |i| i. span ( ) ) )
589- . chain ( clone. iter ( ) . map ( |i| i. span ( ) ) ) ,
590+ . chain ( clone. iter ( ) . map ( |i| i. span ( ) ) )
591+ . chain ( partition_of. iter ( ) . map ( |i| i. span ( ) ) )
592+ . chain ( for_values. iter ( ) . map ( |i| i. span ( ) ) ) ,
590593 )
591594 }
592595}
@@ -624,6 +627,33 @@ impl Spanned for TableConstraint {
624627 }
625628}
626629
630+ impl Spanned for PartitionBoundValue {
631+ fn span ( & self ) -> Span {
632+ match self {
633+ PartitionBoundValue :: Expr ( expr) => expr. span ( ) ,
634+ // MINVALUE and MAXVALUE are keywords without tracked spans
635+ PartitionBoundValue :: MinValue => Span :: empty ( ) ,
636+ PartitionBoundValue :: MaxValue => Span :: empty ( ) ,
637+ }
638+ }
639+ }
640+
641+ impl Spanned for ForValues {
642+ fn span ( & self ) -> Span {
643+ match self {
644+ ForValues :: In ( exprs) => union_spans ( exprs. iter ( ) . map ( |e| e. span ( ) ) ) ,
645+ ForValues :: From { from, to } => union_spans (
646+ from. iter ( )
647+ . map ( |v| v. span ( ) )
648+ . chain ( to. iter ( ) . map ( |v| v. span ( ) ) ) ,
649+ ) ,
650+ // WITH (MODULUS n, REMAINDER r) - u64 values have no spans
651+ ForValues :: With { .. } => Span :: empty ( ) ,
652+ ForValues :: Default => Span :: empty ( ) ,
653+ }
654+ }
655+ }
656+
627657impl Spanned for CreateIndex {
628658 fn span ( & self ) -> Span {
629659 let CreateIndex {
0 commit comments