File tree 1 file changed +6
-2
lines changed
sqlx-postgres/src/connection
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ use crate::HashMap;
12
12
use crate :: { PgColumn , PgConnection , PgTypeInfo } ;
13
13
use futures_core:: future:: BoxFuture ;
14
14
use smallvec:: SmallVec ;
15
+ use sqlx_core:: acquire:: Acquire ;
15
16
use sqlx_core:: executor:: Executor ;
16
17
use sqlx_core:: query_builder:: QueryBuilder ;
17
18
use std:: sync:: Arc ;
@@ -522,9 +523,10 @@ WHERE rngtypid = $1
522
523
523
524
let mut explain = format ! ( "EXPLAIN (VERBOSE, FORMAT JSON) EXECUTE {stmt_id_display}" ) ;
524
525
let mut comma = false ;
526
+ let mut tx = self . begin ( ) . await ?;
525
527
526
528
if params_len > 0 {
527
- self . execute ( "set plan_cache_mode = force_generic_plan;" )
529
+ tx . execute ( "set local plan_cache_mode = force_generic_plan;" )
528
530
. await ?;
529
531
530
532
explain += "(" ;
@@ -543,7 +545,9 @@ WHERE rngtypid = $1
543
545
}
544
546
545
547
let ( Json ( explains) , ) : ( Json < SmallVec < [ Explain ; 1 ] > > , ) =
546
- query_as ( & explain) . fetch_one ( self ) . await ?;
548
+ query_as ( & explain) . fetch_one ( & mut * tx) . await ?;
549
+
550
+ tx. rollback ( ) . await ?;
547
551
548
552
let mut nullables = Vec :: new ( ) ;
549
553
You can’t perform that action at this time.
0 commit comments