Bug #27369 | Incorrect Query Result when using Subqueries and User Defined Varaibles | ||
---|---|---|---|
Submitted: | 22 Mar 2007 9:14 | Modified: | 26 Mar 2007 9:03 |
Reporter: | Jeremy Boote | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | MySQL Server: General | Severity: | S3 (Non-critical) |
Version: | 5.0.33 and 4.1.29 | OS: | Linux (Linux and Windows XP) |
Assigned to: | CPU Architecture: | Any | |
Tags: | command line, php, subquery, User Defined Varaible |
[22 Mar 2007 9:14]
Jeremy Boote
[23 Mar 2007 13:44]
Sveta Smirnova
Thank you for the report. I tested it on Windows with current recommended to download 5.2.1 and MySQL 4.1.23 on Mac, on Linux with "PHP 5.2.2-dev (cli) (built: Mar 5 2007 19:16:35) " and on Mac with PHP6-cvs and with PHP4.4.4 On all machines result was 2. So I'll mark the report as "Can't repeat".
[23 Mar 2007 13:45]
Sveta Smirnova
With 5.0.40 server result was 2 too.
[23 Mar 2007 14:05]
Ulf Wendel
Test script to reproduce the case
Attachment: bug27369.php (application/octet-stream, text), 1.79 KiB.
[23 Mar 2007 14:08]
Ulf Wendel
I also can't repeat it with several PHP/MySQL versions using the script I've uploaded. Please make sure that you have an ORDER BY in your SELECT statement. Without the ORDER BY, results might be random. The return value of 7 indicates that either the SET @j=0 was not successfull or the variable is still set from a previous query run in the session. Are you using persistent connections?
[26 Mar 2007 9:03]
Jeremy Boote
Thank you for your help.... We have discovered the issue, it is a result of mysql_trace_mode being turned on in our .htaccess file. With it on we get 7. With it off we get 2. Not sure where the problem is, or if this is a bug but it does seem rather odd.