Activity log for bug #995501

Date Who What changed Old value New value Message
2012-05-06 14:39:49 Elena Stepanova bug added bug
2012-05-06 14:42:21 Elena Stepanova description The following test case let $run = 0; if ($run) { --perl foreach (1) { print "In perl\n"; } EOF SELECT 1; } --echo # Done fails with mysqltest: At line 9: query 'EOF SELECT 1' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'EOF SELECT 1' at line 1 The problem, how I understand it from a quick look, is that mysqltest attempts to parse the code even inside --perl / EOF block; but it fails because it doesn't expect any 'foreach'es or other ways to start a block except for 'if' or 'while'; so it does not notice a start of the inner block, and the rest of parsing goes all wrong. It only happens when the outer block is not to be executed. For example, this works all right: let $run = 1; if ($run) { --perl foreach (1) { print "In perl\n"; } EOF SELECT 1; } --echo # Done The right approach seems to be totally ignore everything from the beginning of a perl block and till its eof string. Sorry for not providing a patch so far, during the brief investigation I didn't notice an obvious way to fix it, it would require deeper digging from my side, while maybe somebody else would know right away. The problem is a bit of pain for writing reasonably complicated test cases, but so far it seems I can work around it, so I'm setting importance to 'Low' for now. The following test case let $run = 0; if ($run) {   --perl   foreach (1)   {     print "In perl\n";   }   EOF   SELECT 1; } --echo # Done fails with mysqltest: At line 9: query 'EOF SELECT 1' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'EOF SELECT 1' at line 1 Reproducible on MariaDB 5.1-5.5, MySQL 5.1-5.6. The problem, how I understand it from a quick look, is that mysqltest attempts to parse the code even inside --perl / EOF block; but it fails because it doesn't expect any 'foreach'es or other ways to start a block except for 'if' or 'while'; so it does not notice a start of the inner block, and the rest of parsing goes all wrong. It only happens when the outer block is not to be executed. For example, this works all right: let $run = 1; if ($run) {   --perl   foreach (1)   {     print "In perl\n";   }   EOF   SELECT 1; } --echo # Done The right approach seems to be totally ignore everything from the beginning of a perl block and till its eof string. Sorry for not providing a patch so far, during the brief investigation I didn't notice an obvious way to fix it, it would require deeper digging from my side, while maybe somebody else would know right away. The problem is a bit of pain for writing reasonably complicated test cases, but so far it seems I can work around it, so I'm setting importance to 'Low' for now.
2012-05-06 14:42:31 Elena Stepanova tags tests tests upstream
2012-06-01 15:29:20 Launchpad Janitor branch linked lp:~maria-captains/maria/5.1-serg
2012-06-02 05:20:59 Sergei Golubchik maria: status New Fix Committed