@@ -329,9 +329,9 @@ async fn new_raw_pool(
329
329
parsed_dsn : & str ,
330
330
) -> Result < sqlx:: Pool < Postgres > , sqlx:: Error > {
331
331
// sqlx exposes some options as pool options, while other options are available as connection options.
332
- let mut connect_options = PgConnectOptions :: from_str ( parsed_dsn) ?;
333
- // the default is INFO, which is frankly surprising.
334
- connect_options . log_statements ( log:: LevelFilter :: Trace ) ;
332
+ let connect_options = PgConnectOptions :: from_str ( parsed_dsn) ?
333
+ // the default is INFO, which is frankly surprising.
334
+ . log_statements ( log:: LevelFilter :: Trace ) ;
335
335
336
336
let app_name = options. app_name . clone ( ) ;
337
337
let app_name2 = options. app_name . clone ( ) ; // just to log below
@@ -816,7 +816,7 @@ RETURNING *;
816
816
. bind ( name) // $1
817
817
. bind ( partition_template) // $2
818
818
. bind ( namespace_id) // $3
819
- . fetch_one ( & mut tx)
819
+ . fetch_one ( & mut * tx)
820
820
. await
821
821
. map_err ( |e| match e {
822
822
sqlx:: Error :: RowNotFound => Error :: TableCreateLimitError {
@@ -843,7 +843,8 @@ RETURNING *;
843
843
// columns with an unsupported type.
844
844
for template_part in table. partition_template . parts ( ) {
845
845
if let TemplatePart :: TagValue ( tag_name) = template_part {
846
- insert_column_with_connection ( & mut tx, tag_name, table. id , ColumnType :: Tag ) . await ?;
846
+ insert_column_with_connection ( & mut * tx, tag_name, table. id , ColumnType :: Tag )
847
+ . await ?;
847
848
}
848
849
}
849
850
@@ -1538,15 +1539,14 @@ WHERE object_store_id = $1;
1538
1539
) -> Result < Vec < Uuid > > {
1539
1540
sqlx:: query (
1540
1541
// sqlx's readme suggests using PG's ANY operator instead of IN; see link below.
1542
+ // https://github.com/launchbadge/sqlx/blob/main/FAQ.md#how-can-i-do-a-select--where-foo-in--query
1541
1543
r#"
1542
1544
SELECT object_store_id
1543
1545
FROM parquet_file
1544
1546
WHERE object_store_id = ANY($1);
1545
1547
"# ,
1546
1548
)
1547
- // from https://github.com/launchbadge/sqlx/blob/main/FAQ.md#how-can-i-do-a-select--where-foo-in--query
1548
- // a bug of the parameter typechecking code requires all array parameters to be slices
1549
- . bind ( & object_store_ids[ ..] ) // $1
1549
+ . bind ( object_store_ids) // $1
1550
1550
. map ( |pgr| pgr. get :: < Uuid , _ > ( "object_store_id" ) )
1551
1551
. fetch_all ( & mut self . inner )
1552
1552
. await
@@ -1576,13 +1576,13 @@ WHERE object_store_id = ANY($1);
1576
1576
. map_err ( |e| Error :: StartTransaction { source : e } ) ?;
1577
1577
1578
1578
let marked_at = Timestamp :: from ( self . time_provider . now ( ) ) ;
1579
- flag_for_delete ( & mut tx, delete, marked_at) . await ?;
1579
+ flag_for_delete ( & mut * tx, delete, marked_at) . await ?;
1580
1580
1581
- update_compaction_level ( & mut tx, upgrade, target_level) . await ?;
1581
+ update_compaction_level ( & mut * tx, upgrade, target_level) . await ?;
1582
1582
1583
1583
let mut ids = Vec :: with_capacity ( create. len ( ) ) ;
1584
1584
for file in create {
1585
- let id = create_parquet_file ( & mut tx, file) . await ?;
1585
+ let id = create_parquet_file ( & mut * tx, file) . await ?;
1586
1586
ids. push ( id) ;
1587
1587
}
1588
1588
@@ -1667,12 +1667,9 @@ async fn flag_for_delete<'q, E>(
1667
1667
where
1668
1668
E : Executor < ' q , Database = Postgres > ,
1669
1669
{
1670
- // If I try to do `.bind(parquet_file_ids)` directly, I get a compile error from sqlx.
1671
- // See https://github.com/launchbadge/sqlx/issues/1744
1672
- let ids: Vec < _ > = ids. iter ( ) . map ( |p| p. get ( ) ) . collect ( ) ;
1673
1670
let query = sqlx:: query ( r#"UPDATE parquet_file SET to_delete = $1 WHERE id = ANY($2);"# )
1674
1671
. bind ( marked_at) // $1
1675
- . bind ( & ids[ .. ] ) ; // $2
1672
+ . bind ( ids) ; // $2
1676
1673
query
1677
1674
. execute ( executor)
1678
1675
. await
@@ -1689,9 +1686,6 @@ async fn update_compaction_level<'q, E>(
1689
1686
where
1690
1687
E : Executor < ' q , Database = Postgres > ,
1691
1688
{
1692
- // If I try to do `.bind(parquet_file_ids)` directly, I get a compile error from sqlx.
1693
- // See https://github.com/launchbadge/sqlx/issues/1744
1694
- let ids: Vec < _ > = parquet_file_ids. iter ( ) . map ( |p| p. get ( ) ) . collect ( ) ;
1695
1689
let query = sqlx:: query (
1696
1690
r#"
1697
1691
UPDATE parquet_file
@@ -1700,7 +1694,7 @@ WHERE id = ANY($2);
1700
1694
"# ,
1701
1695
)
1702
1696
. bind ( compaction_level) // $1
1703
- . bind ( & ids [ .. ] ) ; // $2
1697
+ . bind ( parquet_file_ids ) ; // $2
1704
1698
query
1705
1699
. execute ( executor)
1706
1700
. await
0 commit comments