Bug #9538 SProc: Creation fails if we try to SET system variable using @@var_name in proc
Submitted: 31 Mar 2005 19:03 Modified: 15 Jul 2005 16:18
Reporter: Disha Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.3 - Beta OS:Windows (Windows Server 2003)
Assigned to: Per-Erik Martin CPU Architecture:Any

[31 Mar 2005 19:03] Disha
Description:
When we try to SET a system variable using @@<variable name> from within a stored procedure the procedure creation fails with a syntax error.

How to repeat:
Repro Steps :

1. Execute the following query:

	create procedure sp1()
	begin
		SET @@sort_buffer_size=1000000;
	end//

2. Observed that the create procedure fails with a syntax error:

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 'sort_buffer_size=1000000;
end' at line 3	

Expected Results : The procedure should be created without any errors or warnings

Actual Results : The procedure creation fails with a syntax error.

Additional info: Instead of @@var_name if we use either SET GLOBAL or SET SESSION syntax to set the variable the procedure creation succeeds and the procedure executes without any errors.

We are able to SET the system variables using @@var_name syntax directly from the mysql prompt.
[15 Jul 2005 15:55] 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/27181
[15 Jul 2005 16:08] Konstantin Osipov
Approved by email.
[15 Jul 2005 16:18] Per-Erik Martin
Pushed to 5.0.10.