>Description: max() and possibly other builtins fail due to apparent rounding errors for any bigints larger than 53 bits or so. Caveats exist in the manual (section 6.2) about bigints larger than 63bit, but the actual useful limit (for these functions) seems much lower. >How-To-Repeat: $ echo '2^53' | bc 9007199254740992
mysql> create table big_nums ( big bigint ); Query OK, 0 rows affected (0.00 sec) mysql> insert into big_nums (big) values (9007199254740992); Query OK, 1 row affected (0.00 sec) mysql> select max(big) from big_nums; +------------------+ | max(big) | +------------------+ | 9007199254740992 | +------------------+ 1 row in set (0.00 sec) mysql> delete from big_nums; Query OK, 0 rows affected (0.00 sec) mysql> insert into big_nums (big) values (9007199254740993); Query OK, 1 row affected (0.00 sec) mysql> select max(big) from big_nums; +------------------+ | max(big) | +------------------+ | 9007199254740992 | +------------------+ 1 row in set (0.00 sec) # Obviously the above should have been '9007199254740993' # Doing select * or using big in a WHERE works fine: mysql> select * from big_nums; +------------------+ | big | +------------------+ | 9007199254740993 | +------------------+ 1 row in set (0.00 sec) mysql> select * from big_nums where big=9007199254740993; +------------------+ | big | +------------------+ | 9007199254740993 | +------------------+ 1 row in set (0.00 sec) >Fix: Don't use bigints bigger than 52 bits with max() :-P >Submitter-Id: <submitter ID> >Originator: Hank Leininger >Organization: utterly dis- >MySQL support: none >Synopsis: max() fails on large (but <63bit) bigint values >Severity: non-critical >Priority: low >Category: mysql >Class: sw-bug >Release: mysql-3.23.46 (Official MySQL binary) >Server: /usr/local/mysql/bin/mysqladmin Ver 8.23 Distrib 3.23.46, for pc-linux-gnu >on i686 Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license Server version 3.23.46 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /tmp/mysql.sock Uptime: 10 days 8 hours 20 min 9 sec Threads: 6 Questions: 8797511 Slow queries: 22 Opens: 1025 Flush tables: 1 Open tables: 64 Queries per second avg: 9.841 >Environment: System: Linux timmy.spinoli.org 2.2.20-hap-2 #3 Sat Nov 10 02:42:23 EST 2001 i686 unknown Architecture: i686 Some paths: /usr/local/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc /usr/bin/cc GCC: Reading specs from /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/specs gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) Compilation info: CC='gcc' CFLAGS='-O3 -mpentium ' CXX='gcc' CXXFLAGS='-O3 -mpentium -felide-constructors' LDFLAGS='-static' LIBC: lrwxrwxrwx 1 root root 13 Mar 4 2001 /lib/libc.so.6 -> libc-2.1.3.so -rwxr-xr-x 1 root root 1013224 Mar 21 2000 /lib/libc-2.1.3.so -rw-r--r-- 1 root root 20266642 Mar 20 2000 /usr/lib/libc.a -rw-r--r-- 1 root root 178 Mar 20 2000 /usr/lib/libc.so lrwxrwxrwx 1 root root 29 Mar 4 2001 /usr/lib/libc.so.1 -> /usr/i486-sysv4/lib/libc.so.1 Configure command: ./configure --prefix=/usr/local/mysql '--with-comment=Official MySQL binary' --with-extra-charsets=complex --with-server-suffix= --enable-assembler --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --disable-shared --------------------------------------------------------------------- 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 <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php