@@ -563,30 +563,10 @@ fn test_snowflake_create_table_with_autoincrement_columns() {
563
563
name: None ,
564
564
option: ColumnOption :: Identity ( Identity :: Autoincrement (
565
565
IdentityProperty {
566
- #[ cfg( not( feature = "bigdecimal" ) ) ]
567
566
parameters: Some ( IdentityFormat :: FunctionCall (
568
567
IdentityParameters {
569
- seed: Expr :: Value ( Value :: Number (
570
- "100" . to_string( ) ,
571
- false
572
- ) ) ,
573
- increment: Expr :: Value ( Value :: Number (
574
- "1" . to_string( ) ,
575
- false
576
- ) ) ,
577
- }
578
- ) ) ,
579
- #[ cfg( feature = "bigdecimal" ) ]
580
- parameters: Some ( IdentityFormat :: FunctionCall (
581
- IdentityParameters {
582
- seed: Expr :: Value ( Value :: Number (
583
- bigdecimal:: BigDecimal :: from( 100 ) ,
584
- false ,
585
- ) ) ,
586
- increment: Expr :: Value ( Value :: Number (
587
- bigdecimal:: BigDecimal :: from( 1 ) ,
588
- false ,
589
- ) ) ,
568
+ seed: Expr :: Value ( number( "100" ) ) ,
569
+ increment: Expr :: Value ( number( "1" ) ) ,
590
570
}
591
571
) ) ,
592
572
order: Some ( IdentityOrder :: NoOrder ) ,
@@ -613,27 +593,10 @@ fn test_snowflake_create_table_with_autoincrement_columns() {
613
593
options: vec![ ColumnOptionDef {
614
594
name: None ,
615
595
option: ColumnOption :: Identity ( Identity :: Identity ( IdentityProperty {
616
- #[ cfg( not( feature = "bigdecimal" ) ) ]
617
- parameters: Some ( IdentityFormat :: StartAndIncrement (
618
- IdentityParameters {
619
- seed: Expr :: Value ( Value :: Number ( "100" . to_string( ) , false ) ) ,
620
- increment: Expr :: Value ( Value :: Number (
621
- "1" . to_string( ) ,
622
- false
623
- ) ) ,
624
- }
625
- ) ) ,
626
- #[ cfg( feature = "bigdecimal" ) ]
627
596
parameters: Some ( IdentityFormat :: StartAndIncrement (
628
597
IdentityParameters {
629
- seed: Expr :: Value ( Value :: Number (
630
- bigdecimal:: BigDecimal :: from( 100 ) ,
631
- false ,
632
- ) ) ,
633
- increment: Expr :: Value ( Value :: Number (
634
- bigdecimal:: BigDecimal :: from( 1 ) ,
635
- false ,
636
- ) ) ,
598
+ seed: Expr :: Value ( number( "100" ) ) ,
599
+ increment: Expr :: Value ( number( "1" ) ) ,
637
600
}
638
601
) ) ,
639
602
order: Some ( IdentityOrder :: Order ) ,
@@ -788,6 +751,89 @@ fn test_snowflake_create_table_with_columns_tags() {
788
751
}
789
752
}
790
753
754
+ #[ test]
755
+ fn test_snowflake_create_table_with_several_column_options ( ) {
756
+ let sql = concat ! (
757
+ "CREATE TABLE my_table (" ,
758
+ "a INT IDENTITY WITH MASKING POLICY p1 USING (a, b) WITH TAG (A='TAG A', B='TAG B'), " ,
759
+ "b TEXT COLLATE 'de_DE' PROJECTION POLICY p2 TAG (C='TAG C', D='TAG D')" ,
760
+ ")"
761
+ ) ;
762
+ match snowflake ( ) . verified_stmt ( sql) {
763
+ Statement :: CreateTable ( CreateTable { columns, .. } ) => {
764
+ assert_eq ! (
765
+ columns,
766
+ vec![
767
+ ColumnDef {
768
+ name: "a" . into( ) ,
769
+ data_type: DataType :: Int ( None ) ,
770
+ collation: None ,
771
+ options: vec![
772
+ ColumnOptionDef {
773
+ name: None ,
774
+ option: ColumnOption :: Identity ( Identity :: Identity (
775
+ IdentityProperty {
776
+ parameters: None ,
777
+ order: None
778
+ }
779
+ ) ) ,
780
+ } ,
781
+ ColumnOptionDef {
782
+ name: None ,
783
+ option: ColumnOption :: Policy ( ColumnPolicy :: MaskingPolicy (
784
+ ColumnPolicyProperty {
785
+ with: true ,
786
+ policy_name: "p1" . into( ) ,
787
+ using_columns: Some ( vec![ "a" . into( ) , "b" . into( ) ] ) ,
788
+ }
789
+ ) ) ,
790
+ } ,
791
+ ColumnOptionDef {
792
+ name: None ,
793
+ option: ColumnOption :: Tags ( TagsColumnOption {
794
+ with: true ,
795
+ tags: vec![
796
+ Tag :: new( "A" . into( ) , "TAG A" . into( ) ) ,
797
+ Tag :: new( "B" . into( ) , "TAG B" . into( ) ) ,
798
+ ]
799
+ } ) ,
800
+ }
801
+ ] ,
802
+ } ,
803
+ ColumnDef {
804
+ name: "b" . into( ) ,
805
+ data_type: DataType :: Text ,
806
+ collation: Some ( ObjectName ( vec![ Ident :: with_quote( '\'' , "de_DE" ) ] ) ) ,
807
+ options: vec![
808
+ ColumnOptionDef {
809
+ name: None ,
810
+ option: ColumnOption :: Policy ( ColumnPolicy :: ProjectionPolicy (
811
+ ColumnPolicyProperty {
812
+ with: false ,
813
+ policy_name: "p2" . into( ) ,
814
+ using_columns: None ,
815
+ }
816
+ ) ) ,
817
+ } ,
818
+ ColumnOptionDef {
819
+ name: None ,
820
+ option: ColumnOption :: Tags ( TagsColumnOption {
821
+ with: false ,
822
+ tags: vec![
823
+ Tag :: new( "C" . into( ) , "TAG C" . into( ) ) ,
824
+ Tag :: new( "D" . into( ) , "TAG D" . into( ) ) ,
825
+ ]
826
+ } ) ,
827
+ }
828
+ ] ,
829
+ } ,
830
+ ]
831
+ ) ;
832
+ }
833
+ _ => unreachable ! ( ) ,
834
+ }
835
+ }
836
+
791
837
#[ test]
792
838
fn parse_sf_create_or_replace_view_with_comment_missing_equal ( ) {
793
839
assert ! ( snowflake_and_generic( )
0 commit comments