File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1166,9 +1166,12 @@ fn try_index_cover(
1166
1166
let ( pos, _) = table. get_column ( & index_column. name ) . unwrap ( ) ;
1167
1167
index_column_map. insert ( pos, i) ;
1168
1168
}
1169
- for pk_name in table. primary_key_column_names . iter ( ) {
1170
- // SAFETY: the primary key column must exist in the table
1171
- let ( pos, _) = table. get_column ( pk_name) . unwrap ( ) ;
1169
+ if table. has_rowid {
1170
+ let pos = table
1171
+ . columns
1172
+ . iter ( )
1173
+ . position ( |column| column. is_rowid_alias )
1174
+ . unwrap ( ) ;
1172
1175
index_column_map. insert ( pos, index_column_map. len ( ) ) ;
1173
1176
}
1174
1177
Original file line number Diff line number Diff line change @@ -318,6 +318,10 @@ do_execsql_test where-age-index-seek-regression-test-2 {
318
318
select count(1) from users where age > 0;
319
319
} {10000}
320
320
321
+ do_execsql_test where-age-index-cover-seek {
322
+ select id, age from users where age > 90;
323
+ } {120|90}
324
+
321
325
do_execsql_test where-simple-between {
322
326
SELECT * FROM products WHERE price BETWEEN 70 AND 100;
323
327
} {1|hat|79.0
You can’t perform that action at this time.
0 commit comments