Commit e5ae4e23 authored by Staale Smedseng's avatar Staale Smedseng

A fix for Bug#22891 "session level max_allowed_packet can be

set but is ignored".
                                  
This patch makes @@session.max_allowed_packed and
@@session.net_buffer_length read-only as suggested in the bug
report. The user will have to use SET GLOBAL (and reconnect)
to alter the session values of these variables.
                            
The error string ER_VARIABLE_IS_READONLY is introduced.
                            
Tests are modified accordingly.


sql/set_var.cc:
  The class sys_var_thd_ulong_session_readonly is introduced as
  a specialization of sys_var_thd_ulong implementing a read-only
  session variable. The class overrides check() and
  check_default() to achieve the read-only property for the
  session part of the variable.
sql/set_var.h:
  The class sys_var_thd_ulong_session_readonly is introduced as
  a specialization of sys_var_thd_ulong implementing a read-only
  session variable. The class overrides check() and
  check_default() to achieve the read-only property for the
  session part of the variable.
sql/share/errmsg.txt:
  New error ER_VARIABLE_IS_READONLY.
parent 36c4b37b
...@@ -68,7 +68,7 @@ Warnings: ...@@ -68,7 +68,7 @@ Warnings:
Error 1259 ZLIB: Input data corrupted Error 1259 ZLIB: Input data corrupted
Error 1256 Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted) Error 1256 Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted)
drop table t1; drop table t1;
set @@max_allowed_packet=1048576*100; set @@global.max_allowed_packet=1048576*100;
select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null; select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null;
compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null
0 0
......
...@@ -2,10 +2,7 @@ SET @start_global_value = @@global.max_allowed_packet; ...@@ -2,10 +2,7 @@ SET @start_global_value = @@global.max_allowed_packet;
SELECT @start_global_value; SELECT @start_global_value;
@start_global_value @start_global_value
1048576 1048576
SET @start_session_value = @@session.max_allowed_packet; SET @@global.max_allowed_packet = DEFAULT;
SELECT @start_session_value;
@start_session_value
1048576
'#--------------------FN_DYNVARS_070_01-------------------------#' '#--------------------FN_DYNVARS_070_01-------------------------#'
SET @@global.max_allowed_packet = 1000; SET @@global.max_allowed_packet = 1000;
Warnings: Warnings:
...@@ -15,7 +12,9 @@ SELECT @@global.max_allowed_packet; ...@@ -15,7 +12,9 @@ SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet @@global.max_allowed_packet
1048576 1048576
SET @@session.max_allowed_packet = 20000; SET @@session.max_allowed_packet = 20000;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SET @@session.max_allowed_packet = DEFAULT; SET @@session.max_allowed_packet = DEFAULT;
ERROR 42000: Variable 'max_allowed_packet' doesn't have a default value
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet @@session.max_allowed_packet
1048576 1048576
...@@ -24,10 +23,6 @@ SET @@global.max_allowed_packet = DEFAULT; ...@@ -24,10 +23,6 @@ SET @@global.max_allowed_packet = DEFAULT;
SELECT @@global.max_allowed_packet = 1048576; SELECT @@global.max_allowed_packet = 1048576;
@@global.max_allowed_packet = 1048576 @@global.max_allowed_packet = 1048576
1 1
SET @@session.max_allowed_packet = DEFAULT;
SELECT @@session.max_allowed_packet = 1048576;
@@session.max_allowed_packet = 1048576
1
'#--------------------FN_DYNVARS_070_03-------------------------#' '#--------------------FN_DYNVARS_070_03-------------------------#'
SET @@global.max_allowed_packet = 1024; SET @@global.max_allowed_packet = 1024;
SELECT @@global.max_allowed_packet; SELECT @@global.max_allowed_packet;
...@@ -48,25 +43,30 @@ SELECT @@global.max_allowed_packet; ...@@ -48,25 +43,30 @@ SELECT @@global.max_allowed_packet;
1073740800 1073740800
'#--------------------FN_DYNVARS_070_04-------------------------#' '#--------------------FN_DYNVARS_070_04-------------------------#'
SET @@session.max_allowed_packet = 1024; SET @@session.max_allowed_packet = 1024;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet @@session.max_allowed_packet
1024 1048576
SET @@session.max_allowed_packet = 1025; SET @@session.max_allowed_packet = 1025;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet @@session.max_allowed_packet
1024 1048576
SET @@session.max_allowed_packet = 65535; SET @@session.max_allowed_packet = 65535;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet @@session.max_allowed_packet
64512 1048576
SET @@session.max_allowed_packet = 1073741824; SET @@session.max_allowed_packet = 1073741824;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet @@session.max_allowed_packet
1073741824 1048576
SET @@session.max_allowed_packet = 1073741823; SET @@session.max_allowed_packet = 1073741823;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet @@session.max_allowed_packet
1073740800 1048576
'#------------------FN_DYNVARS_070_05-----------------------#' '#------------------FN_DYNVARS_070_05-----------------------#'
SET @@global.max_allowed_packet = 0; SET @@global.max_allowed_packet = 0;
Warnings: Warnings:
...@@ -103,37 +103,33 @@ SELECT @@global.max_allowed_packet; ...@@ -103,37 +103,33 @@ SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet @@global.max_allowed_packet
1073741824 1073741824
SET @@session.max_allowed_packet = 0; SET @@session.max_allowed_packet = 0;
Warnings: ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
Warning 1292 Truncated incorrect max_allowed_packet value: '0'
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet @@session.max_allowed_packet
1024 1048576
SET @@session.max_allowed_packet = 1023; SET @@session.max_allowed_packet = 1023;
Warnings: ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
Warning 1292 Truncated incorrect max_allowed_packet value: '1023'
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet @@session.max_allowed_packet
1024 1048576
SET @@session.max_allowed_packet = -2; SET @@session.max_allowed_packet = -2;
Warnings: ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
Warning 1292 Truncated incorrect max_allowed_packet value: '0'
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet @@session.max_allowed_packet
1024 1048576
SET @@session.max_allowed_packet = 65530.34.; SET @@session.max_allowed_packet = 65530.34.;
ERROR 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 '.' at line 1 ERROR 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 '.' at line 1
SET @@session.max_allowed_packet = 10737418241; SET @@session.max_allowed_packet = 10737418241;
Warnings: ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
Warning 1292 Truncated incorrect max_allowed_packet value: '10737418241'
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet @@session.max_allowed_packet
1073741824 1048576
'Bug # 34837: Errors are not coming on assigning invalid values to variable'; 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
SET @@session.max_allowed_packet = test; SET @@session.max_allowed_packet = test;
ERROR 42000: Incorrect argument type to variable 'max_allowed_packet' ERROR 42000: Incorrect argument type to variable 'max_allowed_packet'
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet @@session.max_allowed_packet
1073741824 1048576
'#------------------FN_DYNVARS_070_06-----------------------#' '#------------------FN_DYNVARS_070_06-----------------------#'
SELECT @@global.max_allowed_packet = VARIABLE_VALUE SELECT @@global.max_allowed_packet = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
...@@ -166,6 +162,7 @@ SELECT @@max_allowed_packet = @@global.max_allowed_packet; ...@@ -166,6 +162,7 @@ SELECT @@max_allowed_packet = @@global.max_allowed_packet;
0 0
'#---------------------FN_DYNVARS_070_10----------------------#' '#---------------------FN_DYNVARS_070_10----------------------#'
SET @@max_allowed_packet = 100000; SET @@max_allowed_packet = 100000;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@max_allowed_packet = @@local.max_allowed_packet; SELECT @@max_allowed_packet = @@local.max_allowed_packet;
@@max_allowed_packet = @@local.max_allowed_packet @@max_allowed_packet = @@local.max_allowed_packet
1 1
...@@ -174,9 +171,10 @@ SELECT @@local.max_allowed_packet = @@session.max_allowed_packet; ...@@ -174,9 +171,10 @@ SELECT @@local.max_allowed_packet = @@session.max_allowed_packet;
1 1
'#---------------------FN_DYNVARS_070_11----------------------#' '#---------------------FN_DYNVARS_070_11----------------------#'
SET max_allowed_packet = 1024; SET max_allowed_packet = 1024;
ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@max_allowed_packet; SELECT @@max_allowed_packet;
@@max_allowed_packet @@max_allowed_packet
1024 1048576
SELECT local.max_allowed_packet; SELECT local.max_allowed_packet;
ERROR 42S02: Unknown table 'local' in field list ERROR 42S02: Unknown table 'local' in field list
SELECT session.max_allowed_packet; SELECT session.max_allowed_packet;
...@@ -187,7 +185,6 @@ SET @@global.max_allowed_packet = @start_global_value; ...@@ -187,7 +185,6 @@ SET @@global.max_allowed_packet = @start_global_value;
SELECT @@global.max_allowed_packet; SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet @@global.max_allowed_packet
1048576 1048576
SET @@session.max_allowed_packet = @start_session_value;
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet @@session.max_allowed_packet
1048576 1048576
...@@ -10,24 +10,15 @@ name BLOB ...@@ -10,24 +10,15 @@ name BLOB
'#--------------------FN_DYNVARS_070_01-------------------------#' '#--------------------FN_DYNVARS_070_01-------------------------#'
## Setting value of max_allowed packet and net_buffer_length to 1024 ## ## Setting value of max_allowed packet and net_buffer_length to 1024 ##
SET @@session.max_allowed_packet = 1024; SET @@session.max_allowed_packet = 1024;
SET @@session.net_buffer_length = 1024; ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet @@session.max_allowed_packet
1024 1048576
SET @@session.net_buffer_length = 1024;
ERROR HY000: SESSION variable 'net_buffer_length' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.net_buffer_length; SELECT @@session.net_buffer_length;
@@session.net_buffer_length @@session.net_buffer_length
1024 16384
## Inserting and fetching data of length greater than 1024 ##
INSERT into t1(name) values("aaassssssssddddddddffffffgggggggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
SELECT length("aaaaaasssssssssssdddddddfffffgggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk") as len;
len
1470
## Verifying record in table t1 ##
SELECT * from t1;
id name
1 aaassssssssddddddddffffffgggggggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
'Bug#35381: Error is not coming on inserting and fetching data of length'
'greater than max_allowed_packet size at session level';
'#--------------------FN_DYNVARS_070_02-------------------------#' '#--------------------FN_DYNVARS_070_02-------------------------#'
## Setting value of max_allowed packet and net_buffer_length to 1024 ## ## Setting value of max_allowed packet and net_buffer_length to 1024 ##
SET @@global.max_allowed_packet = 1024; SET @@global.max_allowed_packet = 1024;
......
SET @start_global_value = @@global.net_buffer_length; SET @start_global_value = @@global.net_buffer_length;
SET @start_session_value = @@session.net_buffer_length; SET @@global.net_buffer_length = DEFAULT;
'#--------------------FN_DYNVARS_109_01-------------------------#' '#--------------------FN_DYNVARS_109_01-------------------------#'
SET @@global.net_buffer_length = 10000; SET @@global.net_buffer_length = 10000;
SET @@global.net_buffer_length = DEFAULT; SET @@global.net_buffer_length = DEFAULT;
...@@ -7,7 +7,9 @@ SELECT @@global.net_buffer_length; ...@@ -7,7 +7,9 @@ SELECT @@global.net_buffer_length;
@@global.net_buffer_length @@global.net_buffer_length
16384 16384
SET @@session.net_buffer_length = 20000; SET @@session.net_buffer_length = 20000;
ERROR HY000: SESSION variable 'net_buffer_length' is read-only. Use SET GLOBAL to assign the value
SET @@session.net_buffer_length = DEFAULT; SET @@session.net_buffer_length = DEFAULT;
ERROR 42000: Variable 'net_buffer_length' doesn't have a default value
SELECT @@session.net_buffer_length; SELECT @@session.net_buffer_length;
@@session.net_buffer_length @@session.net_buffer_length
16384 16384
...@@ -16,10 +18,6 @@ SET @@global.net_buffer_length = DEFAULT; ...@@ -16,10 +18,6 @@ SET @@global.net_buffer_length = DEFAULT;
SELECT @@global.net_buffer_length = 16384; SELECT @@global.net_buffer_length = 16384;
@@global.net_buffer_length = 16384 @@global.net_buffer_length = 16384
1 1
SET @@session.net_buffer_length = DEFAULT;
SELECT @@session.net_buffer_length = 16384;
@@session.net_buffer_length = 16384
1
'#--------------------FN_DYNVARS_109_03-------------------------#' '#--------------------FN_DYNVARS_109_03-------------------------#'
SET @@global.net_buffer_length = 1024; SET @@global.net_buffer_length = 1024;
SELECT @@global.net_buffer_length; SELECT @@global.net_buffer_length;
...@@ -43,27 +41,6 @@ SELECT @@global.net_buffer_length; ...@@ -43,27 +41,6 @@ SELECT @@global.net_buffer_length;
64512 64512
'Bug# 34877: Invalid Values are coming in variable on assigning valid values'; 'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
'#--------------------FN_DYNVARS_109_04-------------------------#' '#--------------------FN_DYNVARS_109_04-------------------------#'
SET @@session.net_buffer_length = 1024;
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
1024
SET @@session.net_buffer_length = 1025;
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
1024
SET @@session.net_buffer_length = 1048576;
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
1048576
SET @@session.net_buffer_length = 1048575;
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
1047552
SET @@session.net_buffer_length = 65535;
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
64512
'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
'#------------------FN_DYNVARS_109_05-----------------------#' '#------------------FN_DYNVARS_109_05-----------------------#'
SET @@global.net_buffer_length = 0; SET @@global.net_buffer_length = 0;
Warnings: Warnings:
...@@ -105,42 +82,12 @@ ERROR 42000: Incorrect argument type to variable 'net_buffer_length' ...@@ -105,42 +82,12 @@ ERROR 42000: Incorrect argument type to variable 'net_buffer_length'
SELECT @@global.net_buffer_length; SELECT @@global.net_buffer_length;
@@global.net_buffer_length @@global.net_buffer_length
1048576 1048576
SET @@session.net_buffer_length = 0;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '0'
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
1024
SET @@session.net_buffer_length = -2;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '0'
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
1024
SET @@session.net_buffer_length = 1048577;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '1048577'
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
1048576
SET @@session.net_buffer_length = 1048576002;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '1048576002'
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
1048576
SET @@session.net_buffer_length = 65530.34.;
ERROR 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 '.' at line 1
SET @@session.net_buffer_length = 65550;
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
65536
'Bug # 34837: Errors are not coming on assigning invalid values to variable'; 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
SET @@session.net_buffer_length = test; SET @@session.net_buffer_length = test;
ERROR 42000: Incorrect argument type to variable 'net_buffer_length' ERROR 42000: Incorrect argument type to variable 'net_buffer_length'
SELECT @@session.net_buffer_length; SELECT @@session.net_buffer_length;
@@session.net_buffer_length @@session.net_buffer_length
65536 16384
'#------------------FN_DYNVARS_109_06-----------------------#' '#------------------FN_DYNVARS_109_06-----------------------#'
SELECT @@global.net_buffer_length = VARIABLE_VALUE SELECT @@global.net_buffer_length = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
...@@ -172,18 +119,10 @@ SELECT @@net_buffer_length = @@global.net_buffer_length; ...@@ -172,18 +119,10 @@ SELECT @@net_buffer_length = @@global.net_buffer_length;
@@net_buffer_length = @@global.net_buffer_length @@net_buffer_length = @@global.net_buffer_length
0 0
'#---------------------FN_DYNVARS_109_10----------------------#' '#---------------------FN_DYNVARS_109_10----------------------#'
SET @@net_buffer_length = 100000;
SELECT @@net_buffer_length = @@local.net_buffer_length;
@@net_buffer_length = @@local.net_buffer_length
1
SELECT @@local.net_buffer_length = @@session.net_buffer_length;
@@local.net_buffer_length = @@session.net_buffer_length
1
'#---------------------FN_DYNVARS_109_11----------------------#' '#---------------------FN_DYNVARS_109_11----------------------#'
SET net_buffer_length = 1024;
SELECT @@net_buffer_length; SELECT @@net_buffer_length;
@@net_buffer_length @@net_buffer_length
1024 16384
SELECT local.net_buffer_length; SELECT local.net_buffer_length;
ERROR 42S02: Unknown table 'local' in field list ERROR 42S02: Unknown table 'local' in field list
SELECT session.net_buffer_length; SELECT session.net_buffer_length;
...@@ -191,4 +130,3 @@ ERROR 42S02: Unknown table 'session' in field list ...@@ -191,4 +130,3 @@ ERROR 42S02: Unknown table 'session' in field list
SELECT net_buffer_length = @@session.net_buffer_length; SELECT net_buffer_length = @@session.net_buffer_length;
ERROR 42S22: Unknown column 'net_buffer_length' in 'field list' ERROR 42S22: Unknown column 'net_buffer_length' in 'field list'
SET @@global.net_buffer_length = @start_global_value; SET @@global.net_buffer_length = @start_global_value;
SET @@session.net_buffer_length = @start_session_value;
set global max_allowed_packet=100; set global max_allowed_packet=100;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '100' Warning 1292 Truncated incorrect max_allowed_packet value: '100'
set max_allowed_packet=100;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '100'
set global net_buffer_length=100; set global net_buffer_length=100;
Warnings: Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '100' Warning 1292 Truncated incorrect net_buffer_length value: '100'
set net_buffer_length=100;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '100'
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1024) - truncated
select @@net_buffer_length, @@max_allowed_packet; select @@net_buffer_length, @@max_allowed_packet;
@@net_buffer_length @@max_allowed_packet @@net_buffer_length @@max_allowed_packet
1024 1024 1024 1024
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
ERROR 08S01: Got a packet bigger than 'max_allowed_packet' bytes ERROR 08S01: Got a packet bigger than 'max_allowed_packet' bytes
set global max_allowed_packet=default; set global max_allowed_packet=default;
set max_allowed_packet=default;
set global net_buffer_length=default; set global net_buffer_length=default;
set net_buffer_length=default;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
len len
100 100
......
...@@ -1343,10 +1343,10 @@ t3 CREATE TABLE `t3` ( ...@@ -1343,10 +1343,10 @@ t3 CREATE TABLE `t3` (
`left(a,100000000)` longtext `left(a,100000000)` longtext
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop tables t1,t2,t3; drop tables t1,t2,t3;
SELECT @tmp_max:= @@max_allowed_packet; SELECT @tmp_max:= @@global.max_allowed_packet;
@tmp_max:= @@max_allowed_packet @tmp_max:= @@global.max_allowed_packet
1048576 1048576
SET max_allowed_packet=25000000; SET @@global.max_allowed_packet=25000000;
CREATE TABLE t1 (a mediumtext); CREATE TABLE t1 (a mediumtext);
CREATE TABLE t2 (b varchar(20)); CREATE TABLE t2 (b varchar(20));
INSERT INTO t1 VALUES ('a'); INSERT INTO t1 VALUES ('a');
...@@ -1384,7 +1384,7 @@ t3 CREATE TABLE `t3` ( ...@@ -1384,7 +1384,7 @@ t3 CREATE TABLE `t3` (
`a` varbinary(510) DEFAULT NULL `a` varbinary(510) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLES t1,t2,t3; DROP TABLES t1,t2,t3;
SET max_allowed_packet:= @tmp_max; SET @@global.max_allowed_packet:= @tmp_max;
create table t1 ( id int not null auto_increment, primary key (id), col1 int); create table t1 ( id int not null auto_increment, primary key (id), col1 int);
insert into t1 (col1) values (2),(3),(4),(5),(6); insert into t1 (col1) values (2),(3),(4),(5),(6);
select 99 union all select id from t1 order by 1; select 99 union all select id from t1 order by 1;
......
...@@ -228,7 +228,6 @@ VARIABLE_NAME VARIABLE_VALUE ...@@ -228,7 +228,6 @@ VARIABLE_NAME VARIABLE_VALUE
MYISAM_MAX_SORT_FILE_SIZE FILE_SIZE MYISAM_MAX_SORT_FILE_SIZE FILE_SIZE
set global net_retry_count=10, session net_retry_count=10; set global net_retry_count=10, session net_retry_count=10;
set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300; set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
show global variables like 'net_%'; show global variables like 'net_%';
Variable_name Value Variable_name Value
net_buffer_length 1024 net_buffer_length 1024
...@@ -243,57 +242,45 @@ NET_RETRY_COUNT 10 ...@@ -243,57 +242,45 @@ NET_RETRY_COUNT 10
NET_WRITE_TIMEOUT 200 NET_WRITE_TIMEOUT 200
show session variables like 'net_%'; show session variables like 'net_%';
Variable_name Value Variable_name Value
net_buffer_length 2048 net_buffer_length 16384
net_read_timeout 600 net_read_timeout 30
net_retry_count 10 net_retry_count 10
net_write_timeout 500 net_write_timeout 60
select * from information_schema.session_variables where variable_name like 'net_%' order by 1; select * from information_schema.session_variables where variable_name like 'net_%' order by 1;
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 2048 NET_BUFFER_LENGTH 16384
NET_READ_TIMEOUT 600 NET_READ_TIMEOUT 30
NET_RETRY_COUNT 10 NET_RETRY_COUNT 10
NET_WRITE_TIMEOUT 500 NET_WRITE_TIMEOUT 60
set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000; set global net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
show global variables like 'net_%'; show global variables like 'net_%';
Variable_name Value Variable_name Value
net_buffer_length 1024 net_buffer_length 7168
net_read_timeout 900 net_read_timeout 900
net_retry_count 10 net_retry_count 10
net_write_timeout 1000 net_write_timeout 1000
select * from information_schema.global_variables where variable_name like 'net_%' order by 1; select * from information_schema.global_variables where variable_name like 'net_%' order by 1;
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 1024 NET_BUFFER_LENGTH 7168
NET_READ_TIMEOUT 900 NET_READ_TIMEOUT 900
NET_RETRY_COUNT 10 NET_RETRY_COUNT 10
NET_WRITE_TIMEOUT 1000 NET_WRITE_TIMEOUT 1000
show session variables like 'net_%'; set global net_buffer_length=1;
Variable_name Value
net_buffer_length 7168
net_read_timeout 600
net_retry_count 10
net_write_timeout 500
select * from information_schema.session_variables where variable_name like 'net_%' order by 1;
VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 7168
NET_READ_TIMEOUT 600
NET_RETRY_COUNT 10
NET_WRITE_TIMEOUT 500
set net_buffer_length=1;
Warnings: Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '1' Warning 1292 Truncated incorrect net_buffer_length value: '1'
show variables like 'net_buffer_length'; show global variables like 'net_buffer_length';
Variable_name Value Variable_name Value
net_buffer_length 1024 net_buffer_length 1024
select * from information_schema.session_variables where variable_name like 'net_buffer_length'; select * from information_schema.global_variables where variable_name like 'net_buffer_length';
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 1024 NET_BUFFER_LENGTH 1024
set net_buffer_length=2000000000; set global net_buffer_length=2000000000;
Warnings: Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '2000000000' Warning 1292 Truncated incorrect net_buffer_length value: '2000000000'
show variables like 'net_buffer_length'; show global variables like 'net_buffer_length';
Variable_name Value Variable_name Value
net_buffer_length 1048576 net_buffer_length 1048576
select * from information_schema.session_variables where variable_name like 'net_buffer_length'; select * from information_schema.global_variables where variable_name like 'net_buffer_length';
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 1048576 NET_BUFFER_LENGTH 1048576
set character set cp1251_koi8; set character set cp1251_koi8;
...@@ -461,7 +448,7 @@ select @@long_query_time; ...@@ -461,7 +448,7 @@ select @@long_query_time;
@@long_query_time @@long_query_time
100.000001 100.000001
set low_priority_updates=1; set low_priority_updates=1;
set max_allowed_packet=100; set global max_allowed_packet=100;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '100' Warning 1292 Truncated incorrect max_allowed_packet value: '100'
set global max_binlog_cache_size=100; set global max_binlog_cache_size=100;
...@@ -485,7 +472,7 @@ select @@max_user_connections; ...@@ -485,7 +472,7 @@ select @@max_user_connections;
100 100
set global max_write_lock_count=100; set global max_write_lock_count=100;
set myisam_sort_buffer_size=100; set myisam_sort_buffer_size=100;
set net_buffer_length=100; set global net_buffer_length=100;
Warnings: Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '100' Warning 1292 Truncated incorrect net_buffer_length value: '100'
set net_read_timeout=100; set net_read_timeout=100;
......
...@@ -43,8 +43,11 @@ drop table t1; ...@@ -43,8 +43,11 @@ drop table t1;
# note that when LOW_MEMORY is set the "test" below is meaningless # note that when LOW_MEMORY is set the "test" below is meaningless
# #
set @@max_allowed_packet=1048576*100; set @@global.max_allowed_packet=1048576*100;
--replace_result "''" XXX "'1'" XXX --replace_result "''" XXX "'1'" XXX
# reconnect to make the new max packet size take effect
--connect (newconn, localhost, root,,)
eval select compress(repeat('aaaaaaaaaa', IF('$LOW_MEMORY', 10, 10000000))) is null; eval select compress(repeat('aaaaaaaaaa', IF('$LOW_MEMORY', 10, 10000000))) is null;
# #
......
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
-- disable_query_log -- disable_query_log
-- disable_result_log -- disable_result_log
SET @@max_allowed_packet=16777216; # set packet size and reconnect
SET @@global.max_allowed_packet=16777216;
--connect (newconn, localhost, root,,)
DROP TABLE IF EXISTS bug34300; DROP TABLE IF EXISTS bug34300;
CREATE TABLE bug34300 ( CREATE TABLE bug34300 (
......
...@@ -36,8 +36,13 @@ ...@@ -36,8 +36,13 @@
SET @start_global_value = @@global.max_allowed_packet; SET @start_global_value = @@global.max_allowed_packet;
SELECT @start_global_value; SELECT @start_global_value;
SET @start_session_value = @@session.max_allowed_packet;
SELECT @start_session_value; # give a known value to @@session.max_allowed_packet by assigning to
# @@global and setting up a new connection (for deterministic result
# file diffing)
SET @@global.max_allowed_packet = DEFAULT;
connect (conn1, localhost, root,,);
--echo '#--------------------FN_DYNVARS_070_01-------------------------#' --echo '#--------------------FN_DYNVARS_070_01-------------------------#'
...@@ -49,7 +54,9 @@ SET @@global.max_allowed_packet = 1000; ...@@ -49,7 +54,9 @@ SET @@global.max_allowed_packet = 1000;
SET @@global.max_allowed_packet = DEFAULT; SET @@global.max_allowed_packet = DEFAULT;
SELECT @@global.max_allowed_packet; SELECT @@global.max_allowed_packet;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 20000; SET @@session.max_allowed_packet = 20000;
--Error ER_NO_DEFAULT
SET @@session.max_allowed_packet = DEFAULT; SET @@session.max_allowed_packet = DEFAULT;
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
...@@ -62,9 +69,6 @@ SELECT @@session.max_allowed_packet; ...@@ -62,9 +69,6 @@ SELECT @@session.max_allowed_packet;
SET @@global.max_allowed_packet = DEFAULT; SET @@global.max_allowed_packet = DEFAULT;
SELECT @@global.max_allowed_packet = 1048576; SELECT @@global.max_allowed_packet = 1048576;
SET @@session.max_allowed_packet = DEFAULT;
SELECT @@session.max_allowed_packet = 1048576;
--echo '#--------------------FN_DYNVARS_070_03-------------------------#' --echo '#--------------------FN_DYNVARS_070_03-------------------------#'
############################################################################ ############################################################################
...@@ -86,14 +90,19 @@ SELECT @@global.max_allowed_packet; ...@@ -86,14 +90,19 @@ SELECT @@global.max_allowed_packet;
# Change the value of max_allowed_packet to a valid value for SESSION Scope # # Change the value of max_allowed_packet to a valid value for SESSION Scope #
############################################################################# #############################################################################
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1024; SET @@session.max_allowed_packet = 1024;
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1025; SET @@session.max_allowed_packet = 1025;
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 65535; SET @@session.max_allowed_packet = 65535;
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1073741824; SET @@session.max_allowed_packet = 1073741824;
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1073741823; SET @@session.max_allowed_packet = 1073741823;
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
...@@ -118,14 +127,18 @@ SELECT @@global.max_allowed_packet; ...@@ -118,14 +127,18 @@ SELECT @@global.max_allowed_packet;
SET @@global.max_allowed_packet = test; SET @@global.max_allowed_packet = test;
SELECT @@global.max_allowed_packet; SELECT @@global.max_allowed_packet;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 0; SET @@session.max_allowed_packet = 0;
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1023; SET @@session.max_allowed_packet = 1023;
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = -2; SET @@session.max_allowed_packet = -2;
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
--Error ER_PARSE_ERROR --Error ER_PARSE_ERROR
SET @@session.max_allowed_packet = 65530.34.; SET @@session.max_allowed_packet = 65530.34.;
--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 10737418241; SET @@session.max_allowed_packet = 10737418241;
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; --echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
...@@ -180,6 +193,7 @@ SELECT @@max_allowed_packet = @@global.max_allowed_packet; ...@@ -180,6 +193,7 @@ SELECT @@max_allowed_packet = @@global.max_allowed_packet;
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # # Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
######################################################################################################## ########################################################################################################
--Error ER_VARIABLE_IS_READONLY
SET @@max_allowed_packet = 100000; SET @@max_allowed_packet = 100000;
SELECT @@max_allowed_packet = @@local.max_allowed_packet; SELECT @@max_allowed_packet = @@local.max_allowed_packet;
SELECT @@local.max_allowed_packet = @@session.max_allowed_packet; SELECT @@local.max_allowed_packet = @@session.max_allowed_packet;
...@@ -190,6 +204,7 @@ SELECT @@local.max_allowed_packet = @@session.max_allowed_packet; ...@@ -190,6 +204,7 @@ SELECT @@local.max_allowed_packet = @@session.max_allowed_packet;
# Check if max_allowed_packet can be accessed with and without @@ sign # # Check if max_allowed_packet can be accessed with and without @@ sign #
############################################################################# #############################################################################
--Error ER_VARIABLE_IS_READONLY
SET max_allowed_packet = 1024; SET max_allowed_packet = 1024;
SELECT @@max_allowed_packet; SELECT @@max_allowed_packet;
--Error ER_UNKNOWN_TABLE --Error ER_UNKNOWN_TABLE
...@@ -204,9 +219,9 @@ SELECT max_allowed_packet = @@session.max_allowed_packet; ...@@ -204,9 +219,9 @@ SELECT max_allowed_packet = @@session.max_allowed_packet;
# Restore initial value # # Restore initial value #
#################################### ####################################
connection default;
SET @@global.max_allowed_packet = @start_global_value; SET @@global.max_allowed_packet = @start_global_value;
SELECT @@global.max_allowed_packet; SELECT @@global.max_allowed_packet;
SET @@session.max_allowed_packet = @start_session_value;
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
......
...@@ -43,26 +43,19 @@ name BLOB ...@@ -43,26 +43,19 @@ name BLOB
--echo '#--------------------FN_DYNVARS_070_01-------------------------#' --echo '#--------------------FN_DYNVARS_070_01-------------------------#'
############################################################################### ###############################################################################
# Setting initial value of max_allowed_packet to 1024 at session level and # Setting initial value of max_allowed_packet to 1024 at session level
# verifying its behavior after inserting data greater than 1024 bytes # should result in an error (session variable is readonly)
############################################################################### ###############################################################################
--echo ## Setting value of max_allowed packet and net_buffer_length to 1024 ## --echo ## Setting value of max_allowed packet and net_buffer_length to 1024 ##
--error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1024; SET @@session.max_allowed_packet = 1024;
SET @@session.net_buffer_length = 1024;
SELECT @@session.max_allowed_packet; SELECT @@session.max_allowed_packet;
SELECT @@session.net_buffer_length;
--echo ## Inserting and fetching data of length greater than 1024 ##
INSERT into t1(name) values("aaassssssssddddddddffffffgggggggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
SELECT length("aaaaaasssssssssssdddddddfffffgggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk") as len;
--echo ## Verifying record in table t1 ## --error ER_VARIABLE_IS_READONLY
SELECT * from t1; SET @@session.net_buffer_length = 1024;
SELECT @@session.net_buffer_length;
--echo 'Bug#35381: Error is not coming on inserting and fetching data of length'
--echo 'greater than max_allowed_packet size at session level';
--echo '#--------------------FN_DYNVARS_070_02-------------------------#' --echo '#--------------------FN_DYNVARS_070_02-------------------------#'
############################################################################### ###############################################################################
......
...@@ -38,9 +38,13 @@ ...@@ -38,9 +38,13 @@
SET @start_global_value = @@global.net_buffer_length; SET @start_global_value = @@global.net_buffer_length;
# Due to differences in results of linux and windows # Due to differences in results of linux and windows
#SELECT @start_global_value; #SELECT @start_global_value;
SET @start_session_value = @@session.net_buffer_length;
#SELECT @start_session_value;
# give a known value to @@session.net_buffer_length by assigning to
# @@global and setting up a new connection (for deterministic result
# file diffing)
SET @@global.net_buffer_length = DEFAULT;
connect(con1,localhost,root,,);
connection con1;
--echo '#--------------------FN_DYNVARS_109_01-------------------------#' --echo '#--------------------FN_DYNVARS_109_01-------------------------#'
################################################################# #################################################################
...@@ -51,7 +55,9 @@ SET @@global.net_buffer_length = 10000; ...@@ -51,7 +55,9 @@ SET @@global.net_buffer_length = 10000;
SET @@global.net_buffer_length = DEFAULT; SET @@global.net_buffer_length = DEFAULT;
SELECT @@global.net_buffer_length; SELECT @@global.net_buffer_length;
--Error ER_VARIABLE_IS_READONLY
SET @@session.net_buffer_length = 20000; SET @@session.net_buffer_length = 20000;
--Error ER_NO_DEFAULT
SET @@session.net_buffer_length = DEFAULT; SET @@session.net_buffer_length = DEFAULT;
SELECT @@session.net_buffer_length; SELECT @@session.net_buffer_length;
...@@ -64,9 +70,6 @@ SELECT @@session.net_buffer_length; ...@@ -64,9 +70,6 @@ SELECT @@session.net_buffer_length;
SET @@global.net_buffer_length = DEFAULT; SET @@global.net_buffer_length = DEFAULT;
SELECT @@global.net_buffer_length = 16384; SELECT @@global.net_buffer_length = 16384;
SET @@session.net_buffer_length = DEFAULT;
SELECT @@session.net_buffer_length = 16384;
--echo '#--------------------FN_DYNVARS_109_03-------------------------#' --echo '#--------------------FN_DYNVARS_109_03-------------------------#'
########################################################################### ###########################################################################
...@@ -91,17 +94,7 @@ SELECT @@global.net_buffer_length; ...@@ -91,17 +94,7 @@ SELECT @@global.net_buffer_length;
# Change the value of net_buffer_length to a valid value for SESSION Scope # # Change the value of net_buffer_length to a valid value for SESSION Scope #
############################################################################ ############################################################################
SET @@session.net_buffer_length = 1024; # Bug#22891: SESSION net_buffer_length is now read-only; assignments skipped
SELECT @@session.net_buffer_length;
SET @@session.net_buffer_length = 1025;
SELECT @@session.net_buffer_length;
SET @@session.net_buffer_length = 1048576;
SELECT @@session.net_buffer_length;
SET @@session.net_buffer_length = 1048575;
SELECT @@session.net_buffer_length;
SET @@session.net_buffer_length = 65535;
SELECT @@session.net_buffer_length;
--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
--echo '#------------------FN_DYNVARS_109_05-----------------------#' --echo '#------------------FN_DYNVARS_109_05-----------------------#'
...@@ -126,18 +119,8 @@ SELECT @@global.net_buffer_length; ...@@ -126,18 +119,8 @@ SELECT @@global.net_buffer_length;
SET @@global.net_buffer_length = test; SET @@global.net_buffer_length = test;
SELECT @@global.net_buffer_length; SELECT @@global.net_buffer_length;
SET @@session.net_buffer_length = 0; # Bug#22891: SESSION net_buffer_length is now read-only; assignments skipped
SELECT @@session.net_buffer_length;
SET @@session.net_buffer_length = -2;
SELECT @@session.net_buffer_length;
SET @@session.net_buffer_length = 1048577;
SELECT @@session.net_buffer_length;
SET @@session.net_buffer_length = 1048576002;
SELECT @@session.net_buffer_length;
--Error ER_PARSE_ERROR
SET @@session.net_buffer_length = 65530.34.;
SET @@session.net_buffer_length = 65550;
SELECT @@session.net_buffer_length;
--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; --echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
--Error ER_WRONG_TYPE_FOR_VAR --Error ER_WRONG_TYPE_FOR_VAR
...@@ -190,9 +173,7 @@ SELECT @@net_buffer_length = @@global.net_buffer_length; ...@@ -190,9 +173,7 @@ SELECT @@net_buffer_length = @@global.net_buffer_length;
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # # Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
######################################################################################################## ########################################################################################################
SET @@net_buffer_length = 100000; # Bug#22891: SESSION net_buffer_length is now read-only; assignments skipped
SELECT @@net_buffer_length = @@local.net_buffer_length;
SELECT @@local.net_buffer_length = @@session.net_buffer_length;
--echo '#---------------------FN_DYNVARS_109_11----------------------#' --echo '#---------------------FN_DYNVARS_109_11----------------------#'
...@@ -200,7 +181,7 @@ SELECT @@local.net_buffer_length = @@session.net_buffer_length; ...@@ -200,7 +181,7 @@ SELECT @@local.net_buffer_length = @@session.net_buffer_length;
# Check if net_buffer_length can be accessed with and without @@ sign # # Check if net_buffer_length can be accessed with and without @@ sign #
############################################################################ ############################################################################
SET net_buffer_length = 1024; # Bug#22891: SESSION net_buffer_length is now read-only; assignments skipped
SELECT @@net_buffer_length; SELECT @@net_buffer_length;
--Error ER_UNKNOWN_TABLE --Error ER_UNKNOWN_TABLE
SELECT local.net_buffer_length; SELECT local.net_buffer_length;
...@@ -214,11 +195,11 @@ SELECT net_buffer_length = @@session.net_buffer_length; ...@@ -214,11 +195,11 @@ SELECT net_buffer_length = @@session.net_buffer_length;
# Restore initial value # # Restore initial value #
#################################### ####################################
connection default;
SET @@global.net_buffer_length = @start_global_value; SET @@global.net_buffer_length = @start_global_value;
# Due to differences in results of linux and windows # Due to differences in results of linux and windows
#SELECT @@global.net_buffer_length; #SELECT @@global.net_buffer_length;
SET @@session.net_buffer_length = @start_session_value;
#SELECT @@session.net_buffer_length;
###################################################### ######################################################
......
...@@ -8,30 +8,30 @@ ...@@ -8,30 +8,30 @@
# Check protocol handling # Check protocol handling
# #
connect (con1,localhost,root,,); # setting values below minimum threshold of 1024 will cause truncating
connection con1;
set global max_allowed_packet=100; set global max_allowed_packet=100;
set max_allowed_packet=100;
set global net_buffer_length=100; set global net_buffer_length=100;
set net_buffer_length=100;
# Have to be > 1024 as min value of net_buffer_length is 1024 # is not yet in effect
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
# Should return NULL as 2000 is bigger than max_allowed_packet
select repeat('a',2000); select repeat('a',2000);
# #
# Connection 2 should get error for too big packets # Connection 1 should get error for too big packets
# #
connect (con2,localhost,root,,); connect (con1,localhost,root,,);
connection con2; connection con1;
select @@net_buffer_length, @@max_allowed_packet; select @@net_buffer_length, @@max_allowed_packet;
--error 1153 --error 1153
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
#
# Reset to default values and reconnect
#
set global max_allowed_packet=default; set global max_allowed_packet=default;
set max_allowed_packet=default;
set global net_buffer_length=default; set global net_buffer_length=default;
set net_buffer_length=default; connect (con2,localhost,root,,);
connection con2;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
select length(repeat('a',2000)); select length(repeat('a',2000));
......
...@@ -861,8 +861,10 @@ drop tables t1,t2,t3; ...@@ -861,8 +861,10 @@ drop tables t1,t2,t3;
# exceeds mediumtext maximum length # exceeds mediumtext maximum length
# #
SELECT @tmp_max:= @@max_allowed_packet; SELECT @tmp_max:= @@global.max_allowed_packet;
SET max_allowed_packet=25000000; SET @@global.max_allowed_packet=25000000;
# switching connection to allow the new max_allowed_packet take effect
--connect (newconn, localhost, root,,)
CREATE TABLE t1 (a mediumtext); CREATE TABLE t1 (a mediumtext);
CREATE TABLE t2 (b varchar(20)); CREATE TABLE t2 (b varchar(20));
INSERT INTO t1 VALUES ('a'); INSERT INTO t1 VALUES ('a');
...@@ -884,7 +886,9 @@ INSERT INTO t1 VALUES ('a'); ...@@ -884,7 +886,9 @@ INSERT INTO t1 VALUES ('a');
CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2; CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;
SHOW CREATE TABLE t3; SHOW CREATE TABLE t3;
DROP TABLES t1,t2,t3; DROP TABLES t1,t2,t3;
SET max_allowed_packet:= @tmp_max; --connection default
SET @@global.max_allowed_packet:= @tmp_max;
--disconnect newconn
# #
# Bug #10032 Bug in parsing UNION with ORDER BY when one node does not use FROM # Bug #10032 Bug in parsing UNION with ORDER BY when one node does not use FROM
......
...@@ -146,25 +146,23 @@ show global variables like 'myisam_max_sort_file_size'; ...@@ -146,25 +146,23 @@ show global variables like 'myisam_max_sort_file_size';
--replace_result 9223372036853727232 FILE_SIZE 2146435072 FILE_SIZE --replace_result 9223372036853727232 FILE_SIZE 2146435072 FILE_SIZE
select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size'; select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
# bug#22891: modified to take read-only SESSION net_buffer_length into account
set global net_retry_count=10, session net_retry_count=10; set global net_retry_count=10, session net_retry_count=10;
set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300; set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
show global variables like 'net_%'; show global variables like 'net_%';
select * from information_schema.global_variables where variable_name like 'net_%' order by 1; select * from information_schema.global_variables where variable_name like 'net_%' order by 1;
show session variables like 'net_%'; show session variables like 'net_%';
select * from information_schema.session_variables where variable_name like 'net_%' order by 1; select * from information_schema.session_variables where variable_name like 'net_%' order by 1;
set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000; set global net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
show global variables like 'net_%'; show global variables like 'net_%';
select * from information_schema.global_variables where variable_name like 'net_%' order by 1; select * from information_schema.global_variables where variable_name like 'net_%' order by 1;
show session variables like 'net_%'; set global net_buffer_length=1;
select * from information_schema.session_variables where variable_name like 'net_%' order by 1; show global variables like 'net_buffer_length';
set net_buffer_length=1; select * from information_schema.global_variables where variable_name like 'net_buffer_length';
show variables like 'net_buffer_length';
select * from information_schema.session_variables where variable_name like 'net_buffer_length';
#warning 1292 #warning 1292
set net_buffer_length=2000000000; set global net_buffer_length=2000000000;
show variables like 'net_buffer_length'; show global variables like 'net_buffer_length';
select * from information_schema.session_variables where variable_name like 'net_buffer_length'; select * from information_schema.global_variables where variable_name like 'net_buffer_length';
set character set cp1251_koi8; set character set cp1251_koi8;
show variables like "character_set_client"; show variables like "character_set_client";
...@@ -274,7 +272,7 @@ select @@long_query_time; ...@@ -274,7 +272,7 @@ select @@long_query_time;
set long_query_time=100.000001; set long_query_time=100.000001;
select @@long_query_time; select @@long_query_time;
set low_priority_updates=1; set low_priority_updates=1;
set max_allowed_packet=100; set global max_allowed_packet=100;
set global max_binlog_cache_size=100; set global max_binlog_cache_size=100;
set global max_binlog_size=100; set global max_binlog_size=100;
set global max_connect_errors=100; set global max_connect_errors=100;
...@@ -288,7 +286,7 @@ set global max_user_connections=100; ...@@ -288,7 +286,7 @@ set global max_user_connections=100;
select @@max_user_connections; select @@max_user_connections;
set global max_write_lock_count=100; set global max_write_lock_count=100;
set myisam_sort_buffer_size=100; set myisam_sort_buffer_size=100;
set net_buffer_length=100; set global net_buffer_length=100;
set net_read_timeout=100; set net_read_timeout=100;
set net_write_timeout=100; set net_write_timeout=100;
set global query_cache_limit=100; set global query_cache_limit=100;
......
...@@ -296,7 +296,7 @@ static sys_var_thd_bool sys_sql_low_priority_updates(&vars, "sql_low_priority_up ...@@ -296,7 +296,7 @@ static sys_var_thd_bool sys_sql_low_priority_updates(&vars, "sql_low_priority_up
&SV::low_priority_updates, &SV::low_priority_updates,
fix_low_priority_updates); fix_low_priority_updates);
#endif #endif
static sys_var_thd_ulong sys_max_allowed_packet(&vars, "max_allowed_packet", static sys_var_thd_ulong_session_readonly sys_max_allowed_packet(&vars, "max_allowed_packet",
&SV::max_allowed_packet); &SV::max_allowed_packet);
static sys_var_long_ptr sys_max_binlog_cache_size(&vars, "max_binlog_cache_size", static sys_var_long_ptr sys_max_binlog_cache_size(&vars, "max_binlog_cache_size",
&max_binlog_cache_size); &max_binlog_cache_size);
...@@ -369,7 +369,7 @@ static sys_var_thd_enum sys_myisam_stats_method(&vars, "myisam_stats_met ...@@ -369,7 +369,7 @@ static sys_var_thd_enum sys_myisam_stats_method(&vars, "myisam_stats_met
&myisam_stats_method_typelib, &myisam_stats_method_typelib,
NULL); NULL);
static sys_var_thd_ulong sys_net_buffer_length(&vars, "net_buffer_length", static sys_var_thd_ulong_session_readonly sys_net_buffer_length(&vars, "net_buffer_length",
&SV::net_buffer_length); &SV::net_buffer_length);
static sys_var_thd_ulong sys_net_read_timeout(&vars, "net_read_timeout", static sys_var_thd_ulong sys_net_read_timeout(&vars, "net_read_timeout",
&SV::net_read_timeout, &SV::net_read_timeout,
...@@ -2734,6 +2734,18 @@ uchar *sys_var_max_user_conn::value_ptr(THD *thd, enum_var_type type, ...@@ -2734,6 +2734,18 @@ uchar *sys_var_max_user_conn::value_ptr(THD *thd, enum_var_type type,
} }
bool sys_var_thd_ulong_session_readonly::check(THD *thd, set_var *var)
{
if (var->type != OPT_GLOBAL)
{
my_error(ER_VARIABLE_IS_READONLY, MYF(0), "SESSION", name, "GLOBAL");
return TRUE;
}
return sys_var_thd_ulong::check(thd, var);
}
bool sys_var_thd_lc_time_names::check(THD *thd, set_var *var) bool sys_var_thd_lc_time_names::check(THD *thd, set_var *var)
{ {
MY_LOCALE *locale_match; MY_LOCALE *locale_match;
......
...@@ -1024,6 +1024,29 @@ public: ...@@ -1024,6 +1024,29 @@ public:
}; };
/**
* @brief This is a specialization of sys_var_thd_ulong that implements a
read-only session variable. The class overrides check() and check_default()
to achieve the read-only property for the session part of the variable.
*/
class sys_var_thd_ulong_session_readonly : public sys_var_thd_ulong
{
public:
sys_var_thd_ulong_session_readonly(sys_var_chain *chain_arg,
const char *name_arg, ulong SV::*offset_arg,
sys_check_func c_func= NULL,
sys_after_update_func au_func= NULL,
Binlog_status_enum bl_status_arg= NOT_IN_BINLOG):
sys_var_thd_ulong(chain_arg, name_arg, offset_arg, c_func, au_func, bl_status_arg)
{ }
bool check(THD *thd, set_var *var);
bool check_default(enum_var_type type)
{
return type != OPT_GLOBAL || !option_limits;
}
};
class sys_var_microseconds :public sys_var_thd class sys_var_microseconds :public sys_var_thd
{ {
ulonglong SV::*offset; ulonglong SV::*offset;
......
...@@ -6151,3 +6151,6 @@ WARN_PLUGIN_DELETE_BUILTIN ...@@ -6151,3 +6151,6 @@ WARN_PLUGIN_DELETE_BUILTIN
WARN_PLUGIN_BUSY WARN_PLUGIN_BUSY
eng "Plugin is busy and will be uninstalled on shutdown" eng "Plugin is busy and will be uninstalled on shutdown"
ER_VARIABLE_IS_READONLY
eng "%s variable '%s' is read-only. Use SET %s to assign the value"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment