>Description:
MySQL lies about what ist grater than 0.
>How-To-Repeat:
Imagine having a table...
CREATE TABLE `Customer` (
`ID` int(10) unsigned NOT NULL default '0',
`Seller` tinyint(3) default NULL,
PRIMARY KEY (`ID`));
Seller is either 0, 1 or 2. Look at the following selects:
mysql> select ID,Seller from Customer limit 10;
+----+--------+
| ID | Seller |
+----+--------+
| 1 | 1 |
| 2 | 2 |
| 3 | 0 |
| 4 | 2 |
| 5 | 0 |
| 6 | 1 |
| 7 | 1 |
| 8 | 1 |
| 9 | 1 |
| 10 | 0 |
+----+--------+
10 rows in set (0.01 sec)
mysql> select ID,Seller from Customer where Seller>0 limit 10;
+----+--------+
| ID | Seller |
+----+--------+
| 1 | 1 |
| 6 | 1 |
| 7 | 1 |
| 8 | 1 |
| 9 | 1 |
| 11 | 1 |
| 14 | 1 |
| 15 | 1 |
| 17 | 1 |
| 18 | 1 |
+----+--------+
10 rows in set (0.02 sec)
mysql> select ID,Seller from Customer where Seller!=0 limit 10;
+----+--------+
| ID | Seller |
+----+--------+
| 1 | 1 |
| 2 | 2 |
| 4 | 2 |
| 6 | 1 |
| 7 | 1 |
| 8 | 1 |
| 9 | 1 |
| 11 | 1 |
| 14 | 1 |
| 15 | 1 |
+----+--------+
10 rows in set (0.01 sec)
Has MySQL a problem comparing a tinyint value with a supplied int?
I was able to reproduce this on other versions and other platforms, so what's
this? Any Comments?
>Fix:
>Submitter-Id:
none yet
>Originator: max
>Organization:
>MySQL support: none
>Synopsis: calculation bug
>Severity: serious
>Priority:
>Category: mysql
>Class: sw-bug
>Release: mysql-3.23.29-gamma (Official MySQL binary)
>Server: /usr/local/bin/mysqladmin Ver 8.0 Distrib 3.22.32, for -freebsd4.0 on i386
TCX Datakonsult AB, by Monty
Server version 3.23.29-gamma
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 13 hours 37 min 56 sec
Threads: 6 Questions: 417 Slow queries: 0 Opens: 50 Flush tables: 2 Open tables:
48 Queries per second avg: 0.008
>Environment:
System: FreeBSD fat.techno.net 4.0-RELEASE FreeBSD 4.0-RELEASE #0: Mon Mar 20 22:50:22
GMT 2000 [EMAIL PROTECTED]:/usr/src/sys/compile/GENERIC i386
Some paths: /usr/bin/perl /usr/bin/make /usr/bin/gcc /usr/bin/cc
GCC: Using builtin specs.
gcc version 2.95.2 19991024 (release)
Compilation info: CC='gcc' CFLAGS='-O3 -fomit-frame-pointer' CXX='gcc'
CXXFLAGS='-O3 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti'
LDFLAGS=''
LIBC:
-r--r--r-- 1 root wheel 1128450 Mar 20 2000 /usr/lib/libc.a
lrwxr-xr-x 1 root wheel 9 May 9 00:41 /usr/lib/libc.so -> libc.so.4
-r--r--r-- 1 root wheel 531444 Mar 20 2000 /usr/lib/libc.so.4
Configure command: ./configure --prefix=/usr/local/mysql '--with-comment=Official
MySQL binary' --with-extra-charsets=complex --enable-assembler
--with-named-z-libs=not-used --disable-shared
Perl: This is perl, version 5.005_03 built for i386-freebsd
---------------------------------------------------------------------
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