| Bug #11653 | explicitly labeled LOOP..END LOOP does not compile | ||
|---|---|---|---|
| Submitted: | 30 Jun 2005 7:48 | Modified: | 6 Jul 2005 13:14 |
| Reporter: | Roland Bouman | Email Updates: | |
| Status: | Duplicate | Impact on me: | |
| Category: | MySQL Server | Severity: | S2 (Serious) |
| Version: | 5.0.7 | OS: | Any (Any) |
| Assigned to: | Assigned Account | CPU Architecture: | Any |
[30 Jun 2005 8:01]
Aleksey Kishkin
Hi! tested but was not be able to reproduce. I fyou have any ideas how to catch this bug, pls let us know.
mysql> create procedure bogus()
-> begin
-> l: loop
-> if true then
-> leave l;
-> end if;
-> end loop l;
-> end;
-> //
Query OK, 0 rows affected (0.00 sec)
mysql> select version()//
+------------+
| version() |
+------------+
| 5.0.7-beta |
+------------+
1 row in set (0.02 sec)
[30 Jun 2005 15:45]
Roland Bouman
Hi! I'm really sorry you cannot repeat it. When I saw this, I tried directly from the command line (I used the Query Browser before). I am sad to say that the problem is not solved by changing tools. Could it be the sql_mode I'm using? Here's a sample of my command line output:
mysql> delimiter #
mysql> select @@sql_mode#
+-------------------------------------------------------------+
| @@sql_mode |
+-------------------------------------------------------------+
| REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI |
+-------------------------------------------------------------+
1 row in set (0.03 sec)
mysql> select version()#
+---------------+
| version() |
+---------------+
| 5.0.7-beta-nt |
+---------------+
1 row in set (0.03 sec)
mysql> create procedure myproc()
-> begin
-> myLoop: loop
-> leave myLoop;
-> end loop;
-> end;#
ERROR 1064 (42000): 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 'myLoo
p: loop
leave myLoop;
end loop;
end' at line 2
mysql>
[1 Jul 2005 23:43]
Roland Bouman
Hi Aleksey Kishkin! It seems my problem boils down to bug# 7088. It is all due to the fact that my server default char set is utf 9. When i explicitly set latin1, i can compile. Thanks for your effort!
[1 Jul 2005 23:57]
Roland Bouman
Whoops, sorry ,that's utf 8 not utf 9.
[6 Jul 2005 13:14]
Per-Erik Martin
Dupliate of BUG#7088.

Description: A stored procedure with a labeled LOOP..END LOOP construct does not seem to compile. I suspect it has to do with the loop label, because similar code without a label does compile How to repeat: begin l: loop if true then leave l; end if; end loop l; end; gives me 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 'l: loop if true then leave l; end if; end lo' at line 2 It seems to have to do with the label l:, because this compiles fine (although it will run "forever") : create procedure bogus() begin declare v int; loop if true then set v = 1; end if; end loop; end; Suggested fix: Syntax as it appears in the documentation should compile successfully, and loops should be referencable using labels