Bug #6097 A bug with the number 0
Submitted: 14 Oct 2004 12:56 Modified: 15 Feb 2005 8:08
Reporter: Frederic linot Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.21-standard (Official MySQL RPM) OS:Linux (mandrake)
Assigned to: CPU Architecture:Any

[14 Oct 2004 12:56] Frederic linot
Description:
when you execute the query :
SELECT col_name1, 0, col_name2 FROM table

you expect to get :
+----------------+---+----------------+
| col_name1 | 0 | col_name2 |
+----------------+---+----------------+
|  value 1     | 0  | value 2      |
|  value 3     | 0  | value 4      |
|  ...             | 0  | ...              |
+----------------+---+----------------+

but you have the 1st row replaced by the number 0 instead :

+----------------+---+----------------+
| col_name1 | 0 | col_name2 |
+----------------+---+----------------+
|  0              | 0  | value 2      |
|  0              | 0  | value 4      |
|  ...             | 0  | ...              |
+----------------+---+----------------+

You have not the problem when you execute the query with a number different of zero :
SELECT col_name1, 1, col_name2 FROM table
or
SELECT col_name1, 0.3, col_name2 FROM table
...

------------------------
>Release:	mysql-4.0.21-standard (Official MySQL RPM)

>C compiler:    2.95.3
>C++ compiler:  2.95.3
>Environment:
	<machine, os, target, libraries (multiple lines)>
System: Linux s005122w.d11720100 2.4.18-6mdk #1 Fri Mar 15 02:59:08 CET 2002 i686 unknown
Architecture: i686

Some paths:  /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc /usr/bin/cc
GCC: Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/specs
gcc version 2.96 20000731 (Mandrake Linux 8.2 2.96-0.76mdk)
Compilation info: CC='gcc'  CFLAGS='-O2 -mcpu=i486 -fno-strength-reduce'  CXX='gcc'  CXXFLAGS='-O2 -mcpu=i486 -fno-strength-reduce 	          -felide-constructors -fno-exceptions -fno-rtti 		  '  LDFLAGS=''  ASFLAGS=''
LIBC: 
lrwxrwxrwx    1 root     root           13 sep 24  2002 /lib/libc.so.6 -> libc-2.2.4.so
-rwxr-xr-x    1 root     root      1275300 mar  7  2002 /lib/libc-2.2.4.so
-rw-r--r--    1 root     root     27274138 mar  7  2002 /usr/lib/libc.a
-rw-r--r--    1 root     root          178 mar  7  2002 /usr/lib/libc.so
Configure command: ./configure '--disable-shared' '--with-mysqld-ldflags=-all-static' '--with-client-ldflags=-all-static' '--with-server-suffix=-standard' '--without-embedded-server' '--without-berkeley-db' '--with-innodb' '--without-vio' '--without-openssl' '--enable-assembler' '--enable-local-infile' '--with-mysqld-user=mysql' '--with-unix-socket-path=/var/lib/mysql/mysql.sock' '--prefix=/' '--with-extra-charsets=complex' '--exec-prefix=/usr' '--libexecdir=/usr/sbin' '--libdir=/usr/lib' '--sysconfdir=/etc' '--datadir=/usr/share' '--localstatedir=/var/lib/mysql' '--infodir=/usr/share/info' '--includedir=/usr/include' '--mandir=/usr/share/man' '--enable-thread-safe-client' '--with-comment=Official MySQL RPM' 'CC=gcc' 'CFLAGS=-O2 -mcpu=i486 -fno-strength-reduce' 'CXXFLAGS=-O2 -mcpu=i486 -fno-strength-reduce 	          -felide-constructors -fno-exceptions -fno-rtti 		  ' 'CXX=gcc'

How to repeat:
SELECT col_name1, 1, col_name2 FROM table
select *, 0 from table
SELECT WhatEverYouWant, 0, WhatEverYouWant FROM table

all theses query are buggy

Suggested fix:
;-)
Good luck !

Fred
[15 Oct 2004 11:28] Frederic linot
The probleme is the same when you do
SELECT *, '0' FROM table

(type string '0' and not integer 0)

But when you do 
SELECT *, 0+0 FROM table

It works !

That's why the problem comes pearaps from the parser... because 0+0 is different of 0 ...
[28 Oct 2004 19:41] MySQL Verification Team
Hi,

Thank you for the bug report, but I can't repeat with my test data.
Please, create a repeatable test case.
[14 Feb 2005 22:54] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[15 Feb 2005 8:08] Frederic linot
I'm so sorry...

It was a phpMyAdmin bug and not a MySql bug !!!

Apologies....