BIG INT comparison BUG (3.23.54)

BIG INT comparison BUG (3.23.54)

am 01.02.2003 21:54:01 von Bernhard Graf

How-to-repeat :

mysql> CREATE TABLE test (i int unsigned NOT NULL, l bigint unsigned NOT NULL);
# Insert a very big int (inside 64bit bounds, of course)
mysql> INSERT INTO test VALUES ('4711','4711000000000000001');
# Find it!
mysql> SELECT * FROM test WHERE l>'4711000000000000000';
Empty set (0.00 sec)
# Umm - but this works!
mysql> SELECT * FROM test WHERE l>4711000000000000000;
+------+---------------------+
| i | l |
+------+---------------------+
| 4711 | 4711000000000000001 |
+------+---------------------+
1 row in set (0.00 sec)

--
Bernhard Graf http://www.augensalat.de/


------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread13654@lists.mysql.com
To unsubscribe, e-mail

Re: BIG INT comparison BUG (3.23.54)

am 03.02.2003 13:26:09 von Sinisa Milivojevic

Bernhard Graf writes:
> How-to-repeat :
>
> mysql> CREATE TABLE test (i int unsigned NOT NULL, l bigint unsigned NOT NULL);
> # Insert a very big int (inside 64bit bounds, of course)
> mysql> INSERT INTO test VALUES ('4711','4711000000000000001');
> # Find it!
> mysql> SELECT * FROM test WHERE l>'4711000000000000000';
> Empty set (0.00 sec)
> # Umm - but this works!
> mysql> SELECT * FROM test WHERE l>4711000000000000000;
> +------+---------------------+
> | i | l |
> +------+---------------------+
> | 4711 | 4711000000000000001 |
> +------+---------------------+
> 1 row in set (0.00 sec)
>
> --
> Bernhard Graf http://www.augensalat.de/
>
>

Hi!

This is not a bug.

This is documented behaviour.

When INT's are compared to strings, both are first converted to
floating point values.

--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer
/_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
<___/ www.mysql.com

Join MySQL Users Conference and Expo:
http://www.mysql.com/events/uc2003/


------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread13656@lists.mysql.com
To unsubscribe, e-mail