SET @start_global_value = @@global.sort_buffer_size;
SET @start_session_value = @@session.sort_buffer_size;
'#--------------------FN_DYNVARS_151_01-------------------------#'
SET @@global.sort_buffer_size = 1000;
SET @@global.sort_buffer_size = DEFAULT;
SELECT @@global.sort_buffer_size;
@@global.sort_buffer_size
262144
SET @@session.sort_buffer_size = 2000;
SET @@session.sort_buffer_size = DEFAULT;
SELECT @@session.sort_buffer_size;
@@session.sort_buffer_size
262144
'#--------------------FN_DYNVARS_151_02-------------------------#'
SET @@global.sort_buffer_size = DEFAULT;
SELECT @@global.sort_buffer_size;
@@global.sort_buffer_size
262144
SET @@session.sort_buffer_size = DEFAULT;
SELECT @@session.sort_buffer_size;
@@session.sort_buffer_size
262144
'#--------------------FN_DYNVARS_151_03-------------------------#'
SET @@global.sort_buffer_size = 32776;
SELECT @@global.sort_buffer_size;
@@global.sort_buffer_size
32776
SET @@global.sort_buffer_size = 32777;
SELECT @@global.sort_buffer_size;
@@global.sort_buffer_size
32777
SET @@global.sort_buffer_size = 4294967295;
SELECT @@global.sort_buffer_size;
@@global.sort_buffer_size
4294967295
SET @@global.sort_buffer_size = 4294967294;
SELECT @@global.sort_buffer_size;
@@global.sort_buffer_size
4294967294
'#--------------------FN_DYNVARS_151_04-------------------------#'
SET @@session.sort_buffer_size = 32776;
SELECT @@session.sort_buffer_size;
@@session.sort_buffer_size
32776
SET @@session.sort_buffer_size = 32777;
SELECT @@session.sort_buffer_size;
@@session.sort_buffer_size
32777
SET @@session.sort_buffer_size = 4294967295;
SELECT @@session.sort_buffer_size;
@@session.sort_buffer_size
4294967295
SET @@session.sort_buffer_size = 4294967294;
SELECT @@session.sort_buffer_size;
@@session.sort_buffer_size
4294967294
'#------------------FN_DYNVARS_151_05-----------------------#'
SET @@global.sort_buffer_size = 32775;
SELECT @@global.sort_buffer_size;
@@global.sort_buffer_size
32775
SET @@global.sort_buffer_size = -1024;
SELECT @@global.sort_buffer_size;
@@global.sort_buffer_size
32768
SET @@global.sort_buffer_size = 4294967296;
SELECT @@global.sort_buffer_size;
@@global.sort_buffer_size
4294967295
SET @@global.sort_buffer_size = 65530.34;
ERROR 42000: Incorrect argument type to variable 'sort_buffer_size'
SELECT @@global.sort_buffer_size;
@@global.sort_buffer_size
4294967295
SET @@global.sort_buffer_size = test;
ERROR 42000: Incorrect argument type to variable 'sort_buffer_size'
SELECT @@global.sort_buffer_size;
@@global.sort_buffer_size
4294967295
SET @@session.sort_buffer_size = 32775;
SELECT @@session.sort_buffer_size;
@@session.sort_buffer_size
32775
SET @@session.sort_buffer_size = -2;
SELECT @@session.sort_buffer_size;
@@session.sort_buffer_size
32768
SET @@session.sort_buffer_size = 65530.34;
ERROR 42000: Incorrect argument type to variable 'sort_buffer_size'
SET @@session.sort_buffer_size = 4294967296;
SELECT @@session.sort_buffer_size;
@@session.sort_buffer_size
4294967295
SET @@session.sort_buffer_size = test;
ERROR 42000: Incorrect argument type to variable 'sort_buffer_size'
'#------------------FN_DYNVARS_151_06-----------------------#'
SELECT @@global.sort_buffer_size = VARIABLE_VALUE FROM 
INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size';
@@global.sort_buffer_size = VARIABLE_VALUE
1
'#------------------FN_DYNVARS_151_07-----------------------#'
SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM
INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size';
@@session.sort_buffer_size = VARIABLE_VALUE
1
'#------------------FN_DYNVARS_151_08-----------------------#'
SET @@global.sort_buffer_size = TRUE;
SELECT @@global.sort_buffer_size;
@@global.sort_buffer_size
32768
SET @@global.sort_buffer_size = FALSE;
SELECT @@global.sort_buffer_size;
@@global.sort_buffer_size
32768
'#---------------------FN_DYNVARS_151_09----------------------#'
SET @@global.sort_buffer_size = 9000;
SELECT @@sort_buffer_size = @@global.sort_buffer_size;
@@sort_buffer_size = @@global.sort_buffer_size
0
'#---------------------FN_DYNVARS_151_10----------------------#'
SET @@sort_buffer_size = 9000;
SELECT @@sort_buffer_size = @@local.sort_buffer_size;
@@sort_buffer_size = @@local.sort_buffer_size
1
SELECT @@local.sort_buffer_size = @@session.sort_buffer_size;
@@local.sort_buffer_size = @@session.sort_buffer_size
1
'#---------------------FN_DYNVARS_151_11----------------------#'
SET sort_buffer_size = 9100;
SELECT @@sort_buffer_size;
@@sort_buffer_size
32768
SELECT local.sort_buffer_size;
ERROR 42S02: Unknown table 'local' in field list
SELECT session.sort_buffer_size;
ERROR 42S02: Unknown table 'session' in field list
SELECT sort_buffer_size = @@session.sort_buffer_size;
ERROR 42S22: Unknown column 'sort_buffer_size' in 'field list'
SET @@global.sort_buffer_size = @start_global_value;
SET @@session.sort_buffer_size = @start_session_value;
