Bug #9379 bind select
Submitted: 24 Mar 2005 10:57 Modified: 14 Jul 2005 16:50
Reporter: Berto van de Kraats Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.3-beta-nightly-20050323 OS:Linux (linux)
Assigned to: Konstantin Osipov CPU Architecture:Any

[24 Mar 2005 10:57] Berto van de Kraats
Description:
select statement does not return rows if binded variables are not equally padded

How to repeat:
create table T1 ( c1 integer );
insert into T1 values ( 1 );
insert into T1 values ( 2 );
insert into T1 values ( 3 );

# this statement works fine
SELECT c1 from T1 WHERE 'CHRISTINE           ' = 'CHRISTINE';

+------+
| c1   |
+------+
|    1 |
|    2 |
|    3 |
+------+
3 rows in set (0.00 sec)

# this statement (using binds) does not return any rows
prepare aa from 'SELECT c1 FROM T1 WHERE ?=?';

set @a='CHRISTINE           ';
set @b='CHRISTINE';

execute aa using @a,@b;

Empty set (0.00 sec)
[25 Mar 2005 16:20] Jorge del Conde
THanks for your bug report
[5 Jul 2005 9:00] Berto van de Kraats
Changed Severity to Serious, because this scenario can pop-up in more scenarios then initially estimated (also if the SSA SQL statement contains string literals).
[13 Jul 2005 19:51] Konstantin Osipov
Approved on IRC.
[13 Jul 2005 19:52] Konstantin Osipov
Fixed in 4.1 tree, currently tagged 4.1.14 (merged into 5.0, tagged 5.1.10)
[14 Jul 2005 16:50] Paul DuBois
Noted in 4.1.14, 5.0.10 changelogs.