Bug #9096 | select doesn't return all matched records if prepared statements is used | ||
---|---|---|---|
Submitted: | 10 Mar 2005 16:08 | Modified: | 9 May 2005 2:47 |
Reporter: | Victoria Reznichenko | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 4.1 | OS: | Any (any) |
Assigned to: | Konstantin Osipov | CPU Architecture: | Any |
[10 Mar 2005 16:08]
Victoria Reznichenko
[10 Mar 2005 16:15]
MySQL Verification Team
bug_9096.zip was uploaded to ftp server.
[30 Mar 2005 19:53]
Konstantin Osipov
I was able to repeat the bug. A compact test case is below. drop table if exists t1; create table t1 ( c1 int(11) not null, c2 int(11) not null, c3 int(11) not null, c4 int(11) not null, c5 int(11) not null, c6 int(11), primary key (c1,c2,c5,c3), key c2 (c2), key c1 (c1), key c5 (c5), key c5_2 (c5) ); insert into t1 values (200887, 860, 1, 10, 31, 2); insert into t1 values (200887, 200887, 1, 1, 31, 2); select * from t1 where (c1=200887 and c2=200887 and c5=31 and c3=1) or (c1=200887 and c2=860 and c5=31 and c3=1); prepare stmt from "select * from t1 where (c1=200887 and c2=200887 and c5=31 and c3=1) or (c1=200887 and c2=860 and c5=31 and c3=1)"; execute stmt; execute stmt; prepare stmt from "select * from t1 where (c1=200887 and c2=? and c5=31 and c3=1) or (c1=200887 and c2=? and c5=31 and c3=1)"; set @a=200887, @b=860; execute stmt using @a, @b; execute stmt using @a, @b; deallocate prepare stmt; drop table t1;
[30 Mar 2005 20:01]
Konstantin Osipov
Even simplier: prepare stmt from "select * from t2 where (c1=200887 and c2=?) or c2=?"; execute stmt using @c2, @c2_2;
[17 Apr 2005 2:23]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/internals/24089
[4 May 2005 7:46]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/internals/24541
[4 May 2005 8:05]
Konstantin Osipov
Fixed in 4.1.12 and 5.0.6
[9 May 2005 2:47]
Paul DuBois
Noted in 4.1.12, 5.0.6 changelogs.