| Bug #3796 | Prepared statement, select concat(<parameter>,<column>), wrong result | ||
|---|---|---|---|
| Submitted: | 17 May 2004 11:12 | Modified: | 31 May 2004 13:17 |
| Reporter: | Matthias Leich | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S2 (Serious) |
| Version: | 4.1 | OS: | |
| Assigned to: | Konstantin Osipov | CPU Architecture: | Any |
[17 May 2004 11:15]
Matthias Leich
C program to reproduce the bug
Attachment: neu.c (text/plain), 7.35 KiB.
[17 May 2004 17:54]
Timothy Smith
Verified under 4.1 on FreeBSD 5.2.1
[31 May 2004 13:17]
Konstantin Osipov
Fixed in 4.1.3 (bk commit - 4.1 tree (konstantin:1.1865) BUG#3796)

Description: If the select column list contains a CONCAT(?,<column>) the result set will be wrong. Example: CREATE TABLE test_table(a INT, b VARCHAR(30)) INSERT INTO test_table VALUES(1,'ONE') INSERT INTO test_table VALUES(2,'TWO') prepare, SELECT a, concat(?,b) FROM test_table the value in the bind var is "duplicate" Fetched results ... row 1 column1 (integer) : 1 (length 4) column1 (varchar) : 'duplicateONE' (length 12) row 2 column1 (integer) : 2 (length 4) column1 (varchar) : 'duplicateONETWO' (length 15) 1. The n'th result row seems to contain the constant provided via bind variable and the contents of the column b of the 1. - (n - 1).th result row. 2. The problem seems to be within the server, because Create table t1 as select a, concat(?,b) FROM test_table produces a table t1 with the same strange result content. 3. select a, concat(b,?) works correct My environment: Linux(SuSE 9.0), MySQL 4.1 source distrib. (last bk pull 16.05.2004) MySQL 5.1 last bk pull 11.05.2004 works correct. How to repeat: Please use my attached C program