1
####################### mysql-test\t\pseudo_slave_mode_basic.test ###################
3
# Variable Name: pseudo_slave_mode #
5
# Access Type: Dynamic #
11
# Creation Date: 2012-11-16 #
13
# Description: Test Cases of Dynamic System Variable pseudo_slave_mode #
14
# that checks the behavior of this variable in the following ways#
16
# * Valid & Invalid values #
17
# * Scope & Access method #
20
# Reference: http://dev.mysql.com/doc/refman/5.5/en/ #
21
# server-system-variables.html #
23
###############################################################################
25
--source include/load_sysvars.inc
27
########################################################################
28
# START OF pseudo_slave_mode TESTS #
29
########################################################################
32
##############################################################################
33
# Saving initial value of pseudo_slave_mode in a temporary variable #
34
##############################################################################
36
SET @session_start_value = @@session.pseudo_slave_mode;
37
SELECT @session_start_value;
39
--echo '#--------------------FN_DYNVARS_156_01------------------------#'
40
########################################################################
41
# Display the DEFAULT value of pseudo_slave_mode #
42
########################################################################
44
SET @@session.pseudo_slave_mode = 0;
45
SET @@session.pseudo_slave_mode = DEFAULT;
46
SELECT @@session.pseudo_slave_mode;
48
SET @@session.pseudo_slave_mode = 1;
49
SET @@session.pseudo_slave_mode = DEFAULT;
50
SELECT @@session.pseudo_slave_mode;
53
--echo '#---------------------FN_DYNVARS_156_02-------------------------#'
54
#############################################################################
55
# Check if pseudo_slave_mode can be accessed with and without @@ sign #
56
#############################################################################
58
SET pseudo_slave_mode = 1;
59
SELECT @@pseudo_slave_mode;
61
--Error ER_UNKNOWN_TABLE
62
SELECT session.pseudo_slave_mode;
64
--Error ER_UNKNOWN_TABLE
65
SELECT local.pseudo_slave_mode;
67
SET session pseudo_slave_mode = 0;
68
SELECT @@session.pseudo_slave_mode;
71
--echo '#--------------------FN_DYNVARS_156_03------------------------#'
72
########################################################################
73
# change the value of pseudo_slave_mode to a valid value #
74
########################################################################
76
SET @@session.pseudo_slave_mode = 0;
77
SELECT @@session.pseudo_slave_mode;
78
SET @@session.pseudo_slave_mode = 1;
79
SELECT @@session.pseudo_slave_mode;
82
--echo '#--------------------FN_DYNVARS_156_04-------------------------#'
83
###########################################################################
84
# Change the value of pseudo_slave_mode to invalid value #
85
###########################################################################
87
--Error ER_WRONG_VALUE_FOR_VAR
88
SET @@session.pseudo_slave_mode = -1;
89
--Error ER_WRONG_VALUE_FOR_VAR
90
SET @@session.pseudo_slave_mode = 2;
91
--Error ER_WRONG_VALUE_FOR_VAR
92
SET @@session.pseudo_slave_mode = "T";
93
--Error ER_WRONG_VALUE_FOR_VAR
94
SET @@session.pseudo_slave_mode = "Y";
95
--Error ER_WRONG_VALUE_FOR_VAR
96
SET @@session.pseudo_slave_mode = TR�E;
97
--Error ER_WRONG_VALUE_FOR_VAR
98
SET @@session.pseudo_slave_mode = �N;
99
--Error ER_WRONG_VALUE_FOR_VAR
100
SET @@session.pseudo_slave_mode = OF;
101
--Error ER_WRONG_VALUE_FOR_VAR
102
SET @@session.pseudo_slave_mode = �FF;
103
--Error ER_WRONG_VALUE_FOR_VAR
104
SET @@session.pseudo_slave_mode = '�';
105
--Error ER_WRONG_VALUE_FOR_VAR
106
SET @@session.pseudo_slave_mode = NO;
109
--echo '#-------------------FN_DYNVARS_156_05----------------------------#'
110
###########################################################################
111
# Test if accessing global pseudo_slave_mode gives error #
112
###########################################################################
114
--error ER_LOCAL_VARIABLE
115
SET @@global.pseudo_slave_mode = 0;
116
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
117
SELECT @@global.pseudo_slave_mode;
119
--echo '#----------------------FN_DYNVARS_156_06------------------------#'
120
#########################################################################
121
# Check if the value in SESSION Table contains variable value #
122
#########################################################################
124
SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='pseudo_slave_mode';
126
--echo '#----------------------FN_DYNVARS_156_07------------------------#'
127
#########################################################################
128
# Check if the value in SESSION Table matches value in variable #
129
#########################################################################
131
SELECT IF(@@session.pseudo_slave_mode, "ON", "OFF") = VARIABLE_VALUE
132
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
133
WHERE VARIABLE_NAME='pseudo_slave_mode';
134
SELECT @@session.pseudo_slave_mode;
135
SELECT VARIABLE_VALUE
136
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
137
WHERE VARIABLE_NAME='pseudo_slave_mode';
139
--echo '#---------------------FN_DYNVARS_156_08-------------------------#'
140
###################################################################
141
# Check if ON and OFF values can be used on variable #
142
###################################################################
144
SET @@session.pseudo_slave_mode = OFF;
145
SELECT @@session.pseudo_slave_mode;
146
SET @@session.pseudo_slave_mode = ON;
147
SELECT @@session.pseudo_slave_mode;
149
--echo '#---------------------FN_DYNVARS_156_09----------------------#'
150
###################################################################
151
# Check if TRUE and FALSE values can be used on variable #
152
###################################################################
154
SET @@session.pseudo_slave_mode = TRUE;
155
SELECT @@session.pseudo_slave_mode;
156
SET @@session.pseudo_slave_mode = FALSE;
157
SELECT @@session.pseudo_slave_mode;
159
##############################
160
# Restore initial value #
161
##############################
163
SET @@session.pseudo_slave_mode = @session_start_value;
164
SELECT @@session.pseudo_slave_mode;
166
###############################################################
167
# END OF pseudo_slave_mode TESTS #
168
###############################################################