Bug #16555 | Comparison of constant which is out of range leads to key lookup | ||
---|---|---|---|
Submitted: | 16 Jan 2006 23:48 | Modified: | 30 Aug 2012 11:47 |
Reporter: | Peter Zaitsev (Basic Quality Contributor) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S4 (Feature request) |
Version: | 4.1 | OS: | Linux (linux) |
Assigned to: | Jørgen Løland | CPU Architecture: | Any |
Tags: | qc |
[16 Jan 2006 23:48]
Peter Zaitsev
[17 Jan 2006 12:14]
Aleksey Kishkin
Your MySQL connection id is 2 to server version: 4.1.16 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> explain select count(*) from trunc where i=4147483647; +----+-------------+-------+------+---------------+------+---------+-------+-------+--------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+------+---------------+------+---------+-------+-------+--------------------------+ | 1 | SIMPLE | trunc | ref | i | i | 4 | const | 76039 | Using where; Using index | +----+-------------+-------+------+---------------+------+---------+-------+-------+--------------------------+ 1 row in set, 1 warning (0.04 sec) mysql> show warnings; +---------+------+------------------------------------------------------+ | Level | Code | Message | +---------+------+------------------------------------------------------+ | Warning | 1264 | Data truncated; out of range for column 'i' at row 1 | +---------+------+------------------------------------------------------+ 1 row in set (0.00 sec) mysql> show status like 'Hand%'; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ .... | Handler_read_next | 0 | .... +-----------------------+-------+ 12 rows in set (0.00 sec) mysql> select count(*) from trunc where i=4147483647; +----------+ | count(*) | +----------+ | 0 | +----------+ 1 row in set, 1 warning (0.10 sec) mysql> show status like 'Hand%'; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ ... | Handler_read_next | 76047 | .... +-----------------------+-------+ 12 rows in set (0.00 sec)
[17 Jan 2006 12:15]
Aleksey Kishkin
script for fill testcase tables
Attachment: bug16555.pl (application/x-perl, text), 533 bytes.
[16 Oct 2006 22:45]
Igor Babaev
To evaluate statically predicates using implicit type constrains is definitely a feature request.
[30 Aug 2012 11:47]
Jørgen Løland
Fixed in 5.6.6