Bug #3712 Garbage output
Submitted: 11 May 2004 16:20 Modified: 12 May 2004 18:04
Reporter: Sergei Kulakov (Candidate Quality Contributor) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.18 Windows source OS:Windows (Windows Me)
Assigned to: CPU Architecture:Any

[11 May 2004 16:20] Sergei Kulakov
Description:
I get garbage output for some queries. This bug is similar to bugs #3585 and #3397 (in the end it shows garbage, too), yet they are not identical. 

How to repeat:
I have a simple table PHPFunc having a single VarChar(64) column. I want to produce a PHP function index.

1. Create the table and fill it with data 
CREATE TABLE PHPFuncTest (Func varchar(64))
Insert Into PHPFuncTest Values ('a'), ('b'), ('c'), ('d'), ('e')

2. Test it
Select Func From PHPFuncTest - OK

Now we have 2 sequences for different effects. 
Sequence A:

1. Select Concat('<A HRef=#', Func, '>', Func, '</A>') as FuncLink From PHPFuncTest Group By Func - OK

2. Select Func From PHPFuncTest Group By Func - prefixes records with character Char(255)
a ÿa ÿb ÿc ÿd ÿe

3.Now query 1 produces garbage (HTML excluded):
?ñ.ÐD°.ä.hH°PB°ˆB°ÀB°.@..@D°Ð¡ÿ a b c d e 

Sequence B (swap the queries). In order to make the test pure you have to restart the server:

1. Select Func From PHPFuncTest Group By Func - OK

2. Select Concat('<A HRef=#', Func, '>', Func, '</A>') as FuncLink From PHPFuncTest Group By Func - repeats one record 2*(number of records times) (HTML excluded):
e (10 times)

3. Now query 1 produces this (prefixes records with character Char(255)):
a b c d e ÿa ÿb ÿc ÿd ÿe 

4. (Bonus!) Create another table with the same structure and insert less data into it:
CREATE TABLE PHPFuncTest2 (Func varchar(64))
Insert Into PHPFuncTest2 Values ('a'), ('b'), ('c')

5. Select Func From PHPFuncTest2 Group By Func - shows what query 1 shows for the table PHPFuncTest !!!
a b c d e ÿa ÿb ÿc ÿd ÿe 

I thought it might be query cache but it was initially disabled with query_cache_size 0. When I changed query_cache_limit from 1048576 to 0 and query_cache_type from ON to 0 nothing changed. 

Working over my site I had another case when I got a table full of long random integers instead of a single row. MySQL 4.0.1 which is alpha never produced that stuff. 

Suggested fix:
n/a
[12 May 2004 18:04] MySQL Verification Team
Sorry I wasn't able to repeat the behavior reported.
Could you please provide your \windir\my.ini or c:\my.cnf
for I try again.

Thanks
[14 May 2004 13:11] Sergei Kulakov
my.cnf is actually the default one except for a few things. The last two lines were added later, they didn't change anything

[server]
datadir=C:/MySQL/data
default-character-set=cp1251
set-variable=back_log=5
set-variable=binlog_cache_size=0
set-variable=bulk_insert_buffer_size=1048576
set-variable=flush_time=600
set-variable=key_buffer_size=16777216
set-variable=lower_case_table_names=2
set-variable=max_binlog_cache_size=0
set-variable=query_cache_type=0
set-variable=query_cache_limit=0

I recompiled the server but it produced the same results. I got the same results (actually garbage varies) using PHP+Apache and ODBC 3.51. 
I use Visual C++ 6.0; I did not include innodb and bdb directories in the project at all 'cause I do not use the table handlers; I removed HAVE_INNOBASE_DB, HAVE_BERKELEY_DB from all settings. As linking produced the error about missing nafxcw.lib I unchecked mysqld's dependency on MySqlManager which demanded the library.
I also uploaded http://www.rlsnet.ru/MoreInfo.zip with all the project files that were changed during the build.