@@ -502,7 +502,7 @@ async fn single_default_value_insert(api: &mut dyn TestApi) -> crate::Result<()>
502
502
}
503
503
504
504
#[ cfg( any( feature = "mssql" , feature = "postgresql" ) ) ]
505
- #[ test_each_connector( tags( "mssql" , "postgres " ) ) ]
505
+ #[ test_each_connector( tags( "mssql" , "postgresql " ) ) ]
506
506
async fn returning_insert ( api : & mut dyn TestApi ) -> crate :: Result < ( ) > {
507
507
let table = api. create_table ( "id int, name varchar(255)" ) . await ?;
508
508
let insert = Insert :: single_into ( & table) . value ( "id" , 2 ) . value ( "name" , "Naukio" ) ;
@@ -647,7 +647,7 @@ async fn single_insert_conflict_do_nothing_single_unique_with_autogen_default(
647
647
}
648
648
649
649
#[ cfg( any( feature = "mssql" , feature = "postgresql" ) ) ]
650
- #[ test_each_connector( tags( "postgres " , "mssql" ) ) ]
650
+ #[ test_each_connector( tags( "postgresql " , "mssql" ) ) ]
651
651
async fn single_insert_conflict_do_nothing_with_returning ( api : & mut dyn TestApi ) -> crate :: Result < ( ) > {
652
652
let constraint = api. unique_constraint ( "id" ) ;
653
653
@@ -1073,7 +1073,7 @@ async fn unsigned_integers_are_handled(api: &mut dyn TestApi) -> crate::Result<(
1073
1073
}
1074
1074
1075
1075
#[ cfg( feature = "json" ) ]
1076
- #[ test_each_connector( tags( "mysql" , "postgres " ) ) ]
1076
+ #[ test_each_connector( tags( "mysql" , "postgresql " ) ) ]
1077
1077
async fn json_filtering_works ( api : & mut dyn TestApi ) -> crate :: Result < ( ) > {
1078
1078
let json_type = match api. system ( ) {
1079
1079
"postgres" => "jsonb" ,
@@ -1117,7 +1117,7 @@ async fn json_filtering_works(api: &mut dyn TestApi) -> crate::Result<()> {
1117
1117
Ok ( ( ) )
1118
1118
}
1119
1119
1120
- #[ test_each_connector( tags( "mssql" , "postgres " ) ) ]
1120
+ #[ test_each_connector( tags( "mssql" , "postgresql " ) ) ]
1121
1121
async fn xml_filtering_works ( api : & mut dyn TestApi ) -> crate :: Result < ( ) > {
1122
1122
let table = api
1123
1123
. create_table ( & format ! ( "{}, xmlfield {}" , api. autogen_id( "id" ) , "xml" ) )
@@ -1306,14 +1306,14 @@ async fn op_test_div_one_level(api: &mut dyn TestApi) -> crate::Result<()> {
1306
1306
let row = api. conn ( ) . select ( q) . await ?. into_single ( ) ?;
1307
1307
1308
1308
match api. system ( ) {
1309
- "mssql" => assert_eq ! ( Some ( 2.0 ) , row[ 0 ] . as_f32( ) ) ,
1309
+ "mssql" | "postgres" => assert_eq ! ( Some ( 2.0 ) , row[ 0 ] . as_f32( ) ) ,
1310
1310
_ => assert_eq ! ( Some ( 2.0 ) , row[ 0 ] . as_f64( ) ) ,
1311
1311
}
1312
1312
1313
1313
Ok ( ( ) )
1314
1314
}
1315
1315
1316
- #[ test_each_connector( tags( "postgres " ) ) ]
1316
+ #[ test_each_connector( tags( "postgresql " ) ) ]
1317
1317
async fn enum_values ( api : & mut dyn TestApi ) -> crate :: Result < ( ) > {
1318
1318
let type_name = api. get_name ( ) ;
1319
1319
let create_type = format ! ( "CREATE TYPE {} AS ENUM ('A', 'B')" , & type_name) ;
@@ -1615,3 +1615,32 @@ async fn insert_default_keyword(api: &mut dyn TestApi) -> crate::Result<()> {
1615
1615
1616
1616
Ok ( ( ) )
1617
1617
}
1618
+
1619
+ #[ cfg( feature = "bigdecimal" ) ]
1620
+ #[ test_each_connector( tags( "postgresql" ) ) ]
1621
+ async fn ints_read_write_to_numeric ( api : & mut dyn TestApi ) -> crate :: Result < ( ) > {
1622
+ use bigdecimal:: BigDecimal ;
1623
+ use std:: str:: FromStr ;
1624
+
1625
+ let table = api. create_table ( "id int, value numeric(12,2)" ) . await ?;
1626
+
1627
+ let insert = Insert :: multi_into ( & table, & [ "id" , "value" ] )
1628
+ . values ( vec ! [ Value :: integer( 1 ) , Value :: double( 1234.5 ) ] )
1629
+ . values ( vec ! [ Value :: integer( 2 ) , Value :: integer( 1234 ) ] )
1630
+ . values ( vec ! [ Value :: integer( 3 ) , Value :: integer( 12345 ) ] ) ;
1631
+
1632
+ api. conn ( ) . execute ( insert. into ( ) ) . await ?;
1633
+
1634
+ let select = Select :: from_table ( & table) ;
1635
+ let rows = api. conn ( ) . select ( select) . await ?;
1636
+
1637
+ for ( i, row) in rows. into_iter ( ) . enumerate ( ) {
1638
+ match i {
1639
+ 0 => assert_eq ! ( Value :: numeric( BigDecimal :: from_str( "1234.5" ) . unwrap( ) ) , row[ "value" ] ) ,
1640
+ 1 => assert_eq ! ( Value :: numeric( BigDecimal :: from_str( "1234.0" ) . unwrap( ) ) , row[ "value" ] ) ,
1641
+ _ => assert_eq ! ( Value :: numeric( BigDecimal :: from_str( "12345.0" ) . unwrap( ) ) , row[ "value" ] ) ,
1642
+ }
1643
+ }
1644
+
1645
+ Ok ( ( ) )
1646
+ }
0 commit comments