File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -567,3 +567,37 @@ async fn concurrent_resets_dont_segfault() {
567
567
568
568
sqlx_rt:: sleep ( Duration :: from_millis ( 1 ) ) . await ;
569
569
}
570
+
571
+ // https://github.com/launchbadge/sqlx/issues/1419
572
+ #[ sqlx_macros:: test]
573
+ async fn row_dropped_after_connection_doesnt_panic ( ) {
574
+ let mut conn = SqliteConnection :: connect ( ":memory:" ) . await . unwrap ( ) ;
575
+
576
+ conn. execute (
577
+ "CREATE TABLE IF NOT EXISTS books
578
+ (
579
+ title TEXT NOT NULL,
580
+ created_at INTEGER DEFAULT (cast(strftime('%s','now') as int)),
581
+ updated_at INTEGER DEFAULT (cast(strftime('%s','now') as int))
582
+ );
583
+
584
+ INSERT INTO books(title) VALUES('hello');
585
+ INSERT INTO books(title) VALUES('test');
586
+ INSERT INTO books(title) VALUES('example');
587
+ INSERT INTO books(title) VALUES('stuff');
588
+ INSERT INTO books(title) VALUES('here');
589
+ INSERT INTO books(title) VALUES('there');
590
+ INSERT INTO books(title) VALUES('everywhere');" ,
591
+ )
592
+ . await
593
+ . unwrap ( ) ;
594
+
595
+ let _books = sqlx:: query ( "SELECT * FROM books" )
596
+ . fetch_all ( & mut * conn3)
597
+ . await
598
+ . unwrap ( ) ;
599
+
600
+ // hold `_books` past the lifetime of `conn`
601
+ drop ( conn) ;
602
+ drop ( _books) ;
603
+ }
You can’t perform that action at this time.
0 commit comments