| Bug #34074 | SELECT queries used with WHERE can lead to erroneous return of empty result sets | ||
|---|---|---|---|
| Submitted: | 26 Jan 2008 3:10 | Modified: | 29 Jan 2008 13:19 |
| Reporter: | Jasper Maxwell | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S2 (Serious) |
| Version: | 5.0.41 | OS: | Windows (XP Professional Service Pack 2) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | empty, erroneous, result, SET, sets | ||
[26 Jan 2008 3:10]
Jasper Maxwell
[26 Jan 2008 8:02]
Valeriy Kravchuk
Thank you for a problem report. Please, try to repeat with a newer version, 5.0.45 at least, and inform about the results.
[26 Jan 2008 13:36]
Jasper Maxwell
Updating to server version 5.1.44 does not resolve the problem; updating to server version 6.0.3 does not resolve the problem either.
[26 Jan 2008 19:39]
Valeriy Kravchuk
Sorry, but I can not repeat the behaviour described. Look:
C:\Program Files\MySQL\MySQL Server 5.0>bin\mysql -uroot -proot test -P3308
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.0.54-enterprise-gpl-nt-log MySQL Enterprise Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> CREATE TABLE vm_userdb(
-> Username varchar(30),
-> PasswordHash varchar(30),
-> EMailAddress text,
-> UniqueID varchar(30),
-> YOB varchar(8),
-> AccountCreationDate varchar(17),
-> UserLevel bigint(9),
-> AvatarContent mediumblob,
-> OriginalMachine text,
-> AuthorizedMachines text,
-> Games text,
-> Medals text,
-> TotalThumbsUp bigint(9),
-> TotalThumbsDown bigint(9),
-> FirstName text,
-> LastName text,
-> Gender int(1),
-> AKA text,
-> PersonalDescription text,
-> Location text,
-> ContactInformation text,
-> Notebook text,
-> DownloadSalvage text,
-> SecretQuestion varchar(150),
-> SecretAnswer text,
-> PaymentOptionData text,
-> StoreCredit bigint(9),
-> AdminRemarks text,
-> FreezeReason text,
-> BanReason text,
-> FriendsList text);
Query OK, 0 rows affected (0.38 sec)
mysql> insert into vm_userdb (Username, EMailAddress, UniqueID) values ('xxxxxx'
, 'xx@a.com', '123');
Query OK, 1 row affected (0.08 sec)
mysql> SELECT * FROM vm_userdb WHERE Username = 'xxxxxx'\G
*************************** 1. row ***************************
Username: xxxxxx
PasswordHash: NULL
EMailAddress: xx@a.com
UniqueID: 123
YOB: NULL
AccountCreationDate: NULL
UserLevel: NULL
AvatarContent: NULL
OriginalMachine: NULL
AuthorizedMachines: NULL
Games: NULL
Medals: NULL
TotalThumbsUp: NULL
TotalThumbsDown: NULL
FirstName: NULL
LastName: NULL
Gender: NULL
AKA: NULL
PersonalDescription: NULL
Location: NULL
ContactInformation: NULL
Notebook: NULL
DownloadSalvage: NULL
SecretQuestion: NULL
SecretAnswer: NULL
PaymentOptionData: NULL
StoreCredit: NULL
AdminRemarks: NULL
FreezeReason: NULL
BanReason: NULL
FriendsList: NULL
1 row in set (0.00 sec)
If you have a complete, repeatable test case for any recent version (5.0.45, 5.1.22, 6.0.3), please, copy and paste it as a comment, as I did above.
[26 Jan 2008 23:34]
Jasper Maxwell
Enter password: *************
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 59
Server version: 6.0.3-alpha-community MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> USE PsiDrakePassportSVC
Database changed
mysql> CREATE TABLE vm_userdb(
-> Username varchar(30),
-> PasswordHash varchar(30),
-> EMailAddress text,
-> UniqueID varchar(30),
-> YOB varchar(8),
-> AccountCreationDate varchar(17),
-> UserLevel bigint(9),
-> AvatarContent mediumblob,
-> OriginalMachine text,
-> AuthorizedMachines text,
-> Games text,
-> Medals text,
-> TotalThumbsUp bigint(9),
-> TotalThumbsDown bigint(9),
-> FirstName text,
-> LastName text,
-> Gender int(1),
-> AKA text,
-> PersonalDescription text,
-> Notebook text,
-> DownloadSalvage text,
-> SecretQuestion varchar(150),
-> SecretAnswer text,
-> PaymentOptionData text,
-> StoreCredit bigint(9),
-> AdminRemarks text,
-> FreezeReason text,
-> BanReason text,
-> FriendsList text);
Query OK, 0 rows affected (0.09 sec)
mysql> INSERT INTO vm_userdb (Username, EMailAddress, UniqueID) values ('xxxxxx'
, 'xx@a.com', '123');
Query OK, 1 row affected (0.03 sec)
mysql> SELECT * FROM vm_userdb WHERE Username = 'xxxxxx';
+----------+--------------+--------------+----------+------+--------------------
-+-----------+---------------+-----------------+--------------------+-------+---
-----+---------------+-----------------+-----------+----------+--------+------+-
--------------------+----------+-----------------+----------------+-------------
-+-------------------+-------------+--------------+--------------+-----------+--
-----------+
| Username | PasswordHash | EMailAddress | UniqueID | YOB | AccountCreationDate
| UserLevel | AvatarContent | OriginalMachine | AuthorizedMachines | Games | Me
dals | TotalThumbsUp | TotalThumbsDown | FirstName | LastName | Gender | AKA |
PersonalDescription | Notebook | DownloadSalvage | SecretQuestion | SecretAnswer
| PaymentOptionData | StoreCredit | AdminRemarks | FreezeReason | BanReason | F
riendsList |
+----------+--------------+--------------+----------+------+--------------------
-+-----------+---------------+-----------------+--------------------+-------+---
-----+---------------+-----------------+-----------+----------+--------+------+-
--------------------+----------+-----------------+----------------+-------------
-+-------------------+-------------+--------------+--------------+-----------+--
-----------+
| xxxxxx | NULL | xx@a.com | 123 | NULL | NULL
| NULL | NULL | NULL | NULL | NULL | NU
LL | NULL | NULL | NULL | NULL | NULL | NULL |
NULL | NULL | NULL | NULL | NULL
| NULL | NULL | NULL | NULL | NULL | N
ULL |
+----------+--------------+--------------+----------+------+--------------------
-+-----------+---------------+-----------------+--------------------+-------+---
-----+---------------+-----------------+-----------+----------+--------+------+-
--------------------+----------+-----------------+----------------+-------------
-+-------------------+-------------+--------------+--------------+-----------+--
-----------+
1 row in set (0.00 sec)
(Sorry about the clutter, that's what Command Prompt spewed out.)
Well it seems that I can't reproduce the behavior either using the command line. Perhaps this might mean a problem with my PHP login script and not with MySQL.
[27 Jan 2008 0:31]
Jasper Maxwell
MySQL Bug Report (#34074)
Attachment: mysqlbugreport.txt (text/plain), 9.57 KiB.
[27 Jan 2008 0:32]
Jasper Maxwell
The textfile above is an update to my above reply. It was too long to be posted as a comment so I had to put it in a text file.
[29 Jan 2008 13:19]
Susanne Ebrecht
Many thanks for writing a bug report. Because you can't repeat your issue too, I'll close the bug report now. If you still have a problem, please feel free to open it again.
