[MDEV-9628] Wrong result (missing rows) with TEXT field, optimizer_use_condition_selectivity >= 3 Created: 2016-02-25  Updated: 2016-11-15  Resolved: 2016-11-15

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.0, 10.1
Fix Version/s: 10.0.29

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Igor Babaev
Resolution: Fixed Votes: 0
Labels: None


 Description   

set use_stat_tables='preferably';
set optimizer_use_condition_selectivity=3;
 
create table t1(col1 text);
 
insert into t1 values ('a'),('b'),('c'),('d');
analyze table t1;
 
select * from t1 where col1 > 'b' and col1 < 'd';
 
drop table t1;

Actual result

MariaDB [test]> select * from t1 where col1 > 'b' and col1 < 'd';
Empty set (0.90 sec)

Plan

MariaDB [test]> explain extended select * from t1 where col1 > 'b' and col1 < 'd';
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-----------------------------------------------------+
| id   | select_type | table | type | possible_keys | key  | key_len | ref  | rows | filtered | Extra                                               |
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-----------------------------------------------------+
|    1 | SIMPLE      | NULL  | NULL | NULL          | NULL | NULL    | NULL | NULL |     NULL | Impossible WHERE noticed after reading const tables |
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-----------------------------------------------------+
1 row in set, 1 warning (1.29 sec)
 
MariaDB [test]> show warnings;
+-------+------+--------------------------------------------------------------+
| Level | Code | Message                                                      |
+-------+------+--------------------------------------------------------------+
| Note  | 1003 | select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where 0 |
+-------+------+--------------------------------------------------------------+
1 row in set (0.00 sec)

Expected result

MariaDB [test]> select * from t1 where col1 > 'b' and col1 < 'd';
+------+
| col1 |
+------+
| c    |
+------+
1 row in set (4.71 sec)



 Comments   
Comment by Igor Babaev [ 2016-11-15 ]

The fix for this bug was pushed into 10.0 tree.

Generated at Thu Feb 08 07:36:07 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.