BIGINT for comparing is error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MySQL Server |
Unknown
|
Unknown
|
|||
Percona Server moved to https://jira.percona.com/projects/PS |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
THIS IS THE CASE:
root@localhost : (none) 10:02:29> use test
Database changed
root@localhost : test 10:02:31> create table t_bigint(id bigint unsigned not null primary key auto_increment );
Query OK, 0 rows affected (0.01 sec)
root@localhost : test 10:02:59> create table t_int(id int unsigned not null primary key auto_increment );
Query OK, 0 rows affected (0.00 sec)
root@localhost : test 10:03:08> insert into t_bigint values (1);
Query OK, 1 row affected (0.00 sec)
root@localhost : test 10:03:24> insert into t_bigint values (2);
Query OK, 1 row affected (0.00 sec)
root@localhost : test 10:03:26> insert into t_int values (1);
Query OK, 1 row affected (0.00 sec)
root@localhost : test 10:03:32> insert into t_int values (2);
Query OK, 1 row affected (0.00 sec)
root@localhost : test 10:03:34> select * from t_bigint;
+----+
| id |
+----+
| 1 |
| 2 |
+----+
2 rows in set (0.00 sec)
root@localhost : test 10:03:39> select * from t_int;
+----+
| id |
+----+
| 1 |
| 2 |
+----+
2 rows in set (0.00 sec)
root@localhost : test 10:03:41> select * from t_bigint where id >1.1;
+----+
| id |
+----+
| 2 |
+----+
1 row in set (0.00 sec)
root@localhost : test 10:04:27> select * from t_int where id >1.1;
+----+
| id |
+----+
| 2 |
+----+
1 row in set (0.00 sec)
root@localhost : test 10:04:33> select * from t_bigint where id >=1.1;
+----+
| id |
+----+
| 1 |
| 2 |
+----+
2 rows in set (0.00 sec)
root@localhost : test 10:06:37> select * from t_int where id >=1.1;
+----+
| id |
+----+
| 2 |
+----+
1 row in set (0.00 sec)
Bigint for comparing and calculation is often a problem, but never really fix
Thanks. It's an upstream bug, so I have reported it as http:// bugs.mysql. com/bug. php?id= 63502.