Bug #34829 No default value for variable and setting default does not raise error
Submitted: 26 Feb 2008 12:19 Modified: 15 Mar 2010 23:33
Reporter: Rizwan Maredia Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.1.22, 5.0.56 OS:Microsoft Windows
Assigned to: CPU Architecture:Any
Tags: DEFAULT, default value, system variable

[26 Feb 2008 12:19] Rizwan Maredia
Description:
When DEFAULT is set in some of the variables, nothing happens and the last value stored remains as it is. The following variables have shown this behavior

sql_big_tables
sql_buffer_result
sql_log_off
sql_safe_updates
sql_warnings
sql_big_selects
sql_log_bin
sql_notes
sql_quote_show_create

How to repeat:
The following source code is tested against mysql test environment.

SET @@session.sql_big_tables = 0;
SET @@session.sql_big_tables = DEFAULT;
SELECT @@session.sql_big_tables;
 
SET @@session.sql_big_tables = 1;
SET @@session.sql_big_tables = DEFAULT;
SELECT @@session.sql_big_tables;
 
Output:
SET @@session.sql_big_tables = 0;
SET @@session.sql_big_tables = DEFAULT;
SELECT @@session.sql_big_tables;
@@session.sql_big_tables
0
SET @@session.sql_big_tables = 1;
SET @@session.sql_big_tables = DEFAULT;
SELECT @@session.sql_big_tables;
@@session.sql_big_tables
1

Suggested fix:
On assigning DEFAULT either a DEFAULT value should be assigned or it should raise error that a DEFAULT value is not associated with this variable.
[26 Feb 2008 14:31] Valeriy Kravchuk
Thank you for a bug report.
[6 Mar 2010 10:55] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:vvaintroub@fedora12-20091225154921-x25a5pyw1pxiwobv) (merge vers: 5.5.99) (pib:16)
[15 Mar 2010 23:33] Paul Dubois
Noted in 5.5.3 changelog.

Some system variables could not be assigned the value DEFAULT to
assign their default value.