Bug #12471 mysqltest, --error within loop affects wrong statement
Submitted: 9 Aug 2005 20:41 Modified: 1 Sep 2005 19:21
Reporter: Matthias Leich Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:4.1 OS:
Assigned to: Magnus BlÄudd CPU Architecture:Any

[9 Aug 2005 20:41] Matthias Leich
Description:
Example:
let $num= 2;
while ($num)
{
   --error 1064
   failing_statement;

   dec $num;
}

SELECT 1;

The command line output is
Errors are (from /dev/shm/var/log/mysqltest-time) :
mysqltest: At line 10: query 'SELECT 1' succeeded - 
                                should have failed with errno 1064...
(the last lines may be the most important ones)

This shows, that the error masking ("--error 1064") is
also applied to the "SELECT 1" outside of the loop.

BTW: The "reject" file does not show any unexpected result
         or server response.
failing_statement;
ERROR 42000: You have an error in your SQL syntax; ...
failing_statement;
ERROR 42000: You have an error in your SQL syntax; ...
SELECT 1;

The important and bad consequence of this bug is, that 
you will get a "failed" for this tests, even if you copy
the reject file over the result file.

My environment:
   - Intel PC with Linux(SuSE 9.3)
   - MySQL compiled from source
        Version 4.1 ChangeSet@1.2373, 2005-08-02
        Version 5.0 ChangeSet@1.1960, 2005-08-08

How to repeat:
Please use the attached test case ml043.test
  copy it to mysql-test/t
  echo "Dummy" > r/ml043.result     # Produce a dummy file with 
                                   # expected results
  ./mysql-test-run ml043
  inspect r/ml043.reject    # The protocol of the execution.
                  
  cp r/ml043.reject r/ml043.result
  ./mysql-test-run ml043
[9 Aug 2005 20:42] Matthias Leich
testcase

Attachment: ml043.test (application/test, text), 93 bytes.

[26 Aug 2005 18:31] Jorge del Conde
Verified w/4.1 from bk
[1 Sep 2005 7:34] 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/29153
[1 Sep 2005 19:21] Paul DuBois
No changelog entry needed.