SET @start_session_value = @@session.default_master_connection;
SELECT @start_session_value;
@start_session_value

SET @@session.default_master_connection = 'bar';
SET @@session.default_master_connection = DEFAULT;
SELECT @@session.default_master_connection;
@@session.default_master_connection

SET @@session.default_master_connection = @start_session_value;
SELECT @@session.default_master_connection = '';
@@session.default_master_connection = ''
1
SET @@global.default_master_connection = 'master1';
ERROR HY000: Variable 'default_master_connection' is a SESSION variable and can't be used with SET GLOBAL
SELECT @@global.default_master_connection;
ERROR HY000: Variable 'default_master_connection' is a SESSION variable
SET @@session.default_master_connection = 'master1';
SELECT @@session.default_master_connection;
@@session.default_master_connection
master1
SET @@session.default_master_connection = '';
SELECT @@session.default_master_connection;
@@session.default_master_connection

SET @@session.default_master_connection = '1234-5678';
SELECT @@session.default_master_connection;
@@session.default_master_connection
1234-5678
SET @@session.default_master_connection = '@!*/"';
SELECT @@session.default_master_connection;
@@session.default_master_connection
@!*/"
SET @@session.default_master_connection = REPEAT('a',191);
SELECT @@session.default_master_connection;
@@session.default_master_connection
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
SET @@session.default_master_connection = master2;
SELECT @@session.default_master_connection;
@@session.default_master_connection
master2
SET @@session.default_master_connection = 1;
ERROR 42000: Incorrect argument type to variable 'default_master_connection'
SET @@session.default_master_connection = 65530.30;
ERROR 42000: Incorrect argument type to variable 'default_master_connection'
SET @@session.default_master_connection = FALSE;
ERROR 42000: Incorrect argument type to variable 'default_master_connection'
SELECT @@session.default_master_connection;
@@session.default_master_connection
master2
SET @@session.default_master_connection = REPEAT('a',192);
ERROR 42000: Variable 'default_master_connection' can't be set to the value of 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
SELECT @@session.default_master_connection;
@@session.default_master_connection
master2
SET @@session.default_master_connection = NULL;
ERROR 42000: Variable 'default_master_connection' can't be set to the value of 'NULL'
SELECT @@session.default_master_connection;
@@session.default_master_connection
master2
SELECT @@global.default_master_connection = VARIABLE_VALUE 
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
WHERE VARIABLE_NAME='default_master_connection';
ERROR HY000: Variable 'default_master_connection' is a SESSION variable
SELECT @@session.default_master_connection = VARIABLE_VALUE 
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='default_master_connection';
@@session.default_master_connection = VARIABLE_VALUE
1
SET @@default_master_connection = 'foo';
SELECT @@default_master_connection = @@local.default_master_connection;
@@default_master_connection = @@local.default_master_connection
1
SELECT @@local.default_master_connection = @@session.default_master_connection;
@@local.default_master_connection = @@session.default_master_connection
1
SET default_master_connection = 'foo';
SELECT @@default_master_connection;
@@default_master_connection
foo
SET local.default_master_connection = 'foo';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'default_master_connection = 'foo'' at line 1
SELECT local.default_master_connection;
ERROR 42S02: Unknown table 'local' in field list
SET session.default_master_connection = 'foo';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'default_master_connection = 'foo'' at line 1
SELECT session.default_master_connection;
ERROR 42S02: Unknown table 'session' in field list
SELECT default_master_connection = @@session.default_master_connection;
ERROR 42S22: Unknown column 'default_master_connection' in 'field list'
SET @@session.default_master_connection = @start_session_value;
SELECT @@session.default_master_connection;
@@session.default_master_connection

