Bug #38962 Assignment of a variable to "max_allowed_packet" fails.
Submitted: 22 Aug 2008 14:00 Modified: 26 Aug 2008 1:37
Reporter: Horst Hunger Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.28-debug OS:Linux (2.6.22.18-0.2-default #1 SMP)
Assigned to: CPU Architecture:Any

[22 Aug 2008 14:00] Horst Hunger
Description:
The following statement:

SET @@global.max_allowed_packet= @start_max_allowed_packet;

failed with the following error message:

mysqltest: At line 94: query 'SET @@global.max_allowed_packet= @start_max_allowed_packet' failed: 1232: Incorrect argument type to variable 'max_allowed_packet'

How to repeat:
execute the main test "max_allowed_packet_func.test" after enabling or inserting (if not yet existing) of the "SET" statement at the beginning and end of the program. Comment the "let ..." at both places out, if not yet done. The test exists in main, but not in the newest version. 
You can also execute the newest version which is attached.

Suggested fix:
Allow the requested assignment as it is allowed for other system variables or describe that restriction in the manual.
[22 Aug 2008 15:56] Valeriy Kravchuk
On 5.1.26 I've got:

C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql -uroot -proot -P3310 test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.1.26-rc-community-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SET @start_max_allowed_paket= @@global.max_allowed_packet;
Query OK, 0 rows affected (0.00 sec)

mysql> SET  @@global.max_allowed_packet=@start_max_allowed_paket;
Query OK, 0 rows affected (0.03 sec)

So, it worked in 5.1.26.
[22 Aug 2008 16:21] MySQL Verification Team
I was able to repeat on FC 8 64-bit bzr tree:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.28-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SET @@global.max_allowed_packet= @start_max_allowed_packet;
ERROR 1232 (42000): Incorrect argument type to variable 'max_allowed_packet'
mysql>
[22 Aug 2008 16:25] MySQL Verification Team
Thank you for the bug report.
[26 Aug 2008 1:37] Timothy Smith
This behavior doesn't show up if the variable is properly initialized.  Setting to Not a Bug, since it's OK if assigning from an uninitialized variable doesn't take effect.