| 1 |
############## mysql-test\t\updatable_views_with_limit_basic.test ############# |
| 2 |
# # |
| 3 |
# Variable Name: updatable_views_with_limit # |
| 4 |
# Scope: GLOBAL | SESSION # |
| 5 |
# Access Type: Dynamic # |
| 6 |
# Data Type: boolean # |
| 7 |
# Default Value: 1 # |
| 8 |
# Range: # |
| 9 |
# # |
| 10 |
# # |
| 11 |
# Creation Date: 2008-02-14 # |
| 12 |
# Author: Sharique Abdullah # |
| 13 |
# # |
| 14 |
# Description: Test Case of Dynamic System Variable updatable_views_with_limit# |
| 15 |
# that checks the behavior of this variable in the following ways# |
| 16 |
# * Default Value # |
| 17 |
# * Valid & Invalid values # |
| 18 |
# * Scope & Access method # |
| 19 |
# * Data Integrity # |
| 20 |
# # |
| 21 |
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # |
| 22 |
# server-system-variables.html#option_mysqld_updatable_views_with_limit # |
| 23 |
# # |
| 24 |
############################################################################### |
| 25 |
|
| 26 |
--source include/load_sysvars.inc |
| 27 |
|
| 28 |
######################################################################## |
| 29 |
# START OF updatable_views_with_limit TESTS # |
| 30 |
######################################################################## |
| 31 |
|
| 32 |
|
| 33 |
############################################################# |
| 34 |
# Save initial value # |
| 35 |
############################################################# |
| 36 |
|
| 37 |
SET @start_global_value = @@global.updatable_views_with_limit; |
| 38 |
SELECT @start_global_value; |
| 39 |
SET @start_session_value = @@session.updatable_views_with_limit; |
| 40 |
SELECT @start_session_value; |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
--echo '#--------------------FN_DYNVARS_005_01-------------------------#' |
| 45 |
######################################################################## |
| 46 |
# Display the DEFAULT value of updatable_views_with_limit # |
| 47 |
######################################################################## |
| 48 |
|
| 49 |
SET @@global.updatable_views_with_limit = 'NO'; |
| 50 |
SET @@global.updatable_views_with_limit = DEFAULT; |
| 51 |
SELECT @@global.updatable_views_with_limit; |
| 52 |
|
| 53 |
|
| 54 |
SET @@session.updatable_views_with_limit = 'NO'; |
| 55 |
SET @@session.updatable_views_with_limit = DEFAULT; |
| 56 |
SELECT @@session.updatable_views_with_limit; |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
--echo '#--------------------FN_DYNVARS_005_02-------------------------#' |
| 61 |
######################################################################## |
| 62 |
# Check the DEFAULT value of updatable_views_with_limit # |
| 63 |
######################################################################## |
| 64 |
|
| 65 |
SET @@global.updatable_views_with_limit = DEFAULT; |
| 66 |
SELECT @@global.updatable_views_with_limit = 'Yes'; |
| 67 |
|
| 68 |
SET @@session.updatable_views_with_limit = DEFAULT; |
| 69 |
SELECT @@session.updatable_views_with_limit ='Yes'; |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
--echo '#--------------------FN_DYNVARS_005_03-------------------------#' |
| 74 |
################################################################## |
| 75 |
# Change the value of variable to a valid value for GLOBAL Scope # |
| 76 |
################################################################## |
| 77 |
|
| 78 |
SET @@global.updatable_views_with_limit = NO; |
| 79 |
SELECT @@global.updatable_views_with_limit; |
| 80 |
|
| 81 |
SET @@global.updatable_views_with_limit = 'NO'; |
| 82 |
SELECT @@global.updatable_views_with_limit; |
| 83 |
|
| 84 |
SET @@global.updatable_views_with_limit = YES; |
| 85 |
SELECT @@global.updatable_views_with_limit; |
| 86 |
|
| 87 |
SET @@global.updatable_views_with_limit = 'YES'; |
| 88 |
SELECT @@global.updatable_views_with_limit; |
| 89 |
|
| 90 |
SET @@global.updatable_views_with_limit = "NO"; |
| 91 |
SELECT @@global.updatable_views_with_limit; |
| 92 |
|
| 93 |
SET @@global.updatable_views_with_limit = "YES"; |
| 94 |
SELECT @@global.updatable_views_with_limit; |
| 95 |
|
| 96 |
SET @@global.updatable_views_with_limit = 1; |
| 97 |
SELECT @@global.updatable_views_with_limit; |
| 98 |
|
| 99 |
SET @@global.updatable_views_with_limit = 0; |
| 100 |
SELECT @@global.updatable_views_with_limit; |
| 101 |
|
| 102 |
SET @@global.updatable_views_with_limit = TRUE; |
| 103 |
SELECT @@global.updatable_views_with_limit; |
| 104 |
|
| 105 |
SET @@global.updatable_views_with_limit = False; |
| 106 |
SELECT @@global.updatable_views_with_limit; |
| 107 |
|
| 108 |
|
| 109 |
--echo '#--------------------FN_DYNVARS_005_04-------------------------#' |
| 110 |
################################################################### |
| 111 |
# Change the value of variable to a valid value for SESSION Scope # |
| 112 |
################################################################### |
| 113 |
|
| 114 |
SET @@session.updatable_views_with_limit = NO; |
| 115 |
SELECT @@session.updatable_views_with_limit; |
| 116 |
|
| 117 |
SET @@session.updatable_views_with_limit = 'NO'; |
| 118 |
SELECT @@session.updatable_views_with_limit; |
| 119 |
|
| 120 |
SET @@session.updatable_views_with_limit = YES; |
| 121 |
SELECT @@session.updatable_views_with_limit; |
| 122 |
|
| 123 |
SET @@session.updatable_views_with_limit = 'YES'; |
| 124 |
SELECT @@session.updatable_views_with_limit; |
| 125 |
|
| 126 |
SET @@session.updatable_views_with_limit = "YES"; |
| 127 |
SELECT @@session.updatable_views_with_limit; |
| 128 |
|
| 129 |
SET @@session.updatable_views_with_limit = "NO"; |
| 130 |
SELECT @@session.updatable_views_with_limit; |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
SET @@session.updatable_views_with_limit =1; |
| 135 |
SELECT @@session.updatable_views_with_limit; |
| 136 |
|
| 137 |
SET @@session.updatable_views_with_limit = 0; |
| 138 |
SELECT @@session.updatable_views_with_limit; |
| 139 |
|
| 140 |
SET @@session.updatable_views_with_limit = True; |
| 141 |
SELECT @@session.updatable_views_with_limit; |
| 142 |
|
| 143 |
SET @@session.updatable_views_with_limit = False; |
| 144 |
SELECT @@session.updatable_views_with_limit; |
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
--echo '#------------------FN_DYNVARS_005_05-----------------------#' |
| 149 |
######################################################################## |
| 150 |
# Change the value of 'updatable_views_with_limit' to an invalid value # |
| 151 |
######################################################################## |
| 152 |
|
| 153 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 154 |
SET @@global.updatable_views_with_limit = "TRUE"; |
| 155 |
|
| 156 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 157 |
SET @@global.updatable_views_with_limit = -1024; |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 162 |
SET @@global.updatable_views_with_limit = 2345; |
| 163 |
|
| 164 |
|
| 165 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 166 |
SET @@global.updatable_views_with_limit = "FALSE"; |
| 167 |
|
| 168 |
|
| 169 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 170 |
SET @@global.updatable_views_with_limit = 65530.34; |
| 171 |
|
| 172 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 173 |
SET @@global.updatable_views_with_limit ="Testing"; |
| 174 |
|
| 175 |
|
| 176 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 177 |
SET @@session.updatable_views_with_limit = "ON"; |
| 178 |
|
| 179 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 180 |
SET @@session.updatable_views_with_limit = "OFF"; |
| 181 |
|
| 182 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 183 |
SET @@session.updatable_views_with_limit = "True"; |
| 184 |
|
| 185 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 186 |
SET @@session.updatable_views_with_limit = "False"; |
| 187 |
|
| 188 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 189 |
SET @@session.updatable_views_with_limit = "Test"; |
| 190 |
|
| 191 |
|
| 192 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 193 |
SET @@session.updatable_views_with_limit = 'test'; |
| 194 |
|
| 195 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 196 |
SET @@session.updatable_views_with_limit = 123456789031; |
| 197 |
|
| 198 |
|
| 199 |
--echo '#------------------FN_DYNVARS_005_06-----------------------#' |
| 200 |
#################################################################### |
| 201 |
# Check if the value in GLOBAL Table matches value in variable # |
| 202 |
#################################################################### |
| 203 |
|
| 204 |
--disable_warnings |
| 205 |
SELECT @@global.updatable_views_with_limit = VARIABLE_VALUE |
| 206 |
FROM performance_schema.global_variables |
| 207 |
WHERE VARIABLE_NAME='updatable_views_with_limit'; |
| 208 |
--enable_warnings |
| 209 |
|
| 210 |
--echo '#------------------FN_DYNVARS_005_07-----------------------#' |
| 211 |
#################################################################### |
| 212 |
# Check if the value in SESSION Table matches value in variable # |
| 213 |
#################################################################### |
| 214 |
|
| 215 |
--disable_warnings |
| 216 |
SELECT @@session.updatable_views_with_limit = VARIABLE_VALUE |
| 217 |
FROM performance_schema.session_variables |
| 218 |
WHERE VARIABLE_NAME='updatable_views_with_limit'; |
| 219 |
--enable_warnings |
| 220 |
|
| 221 |
--echo '#---------------------FN_DYNVARS_001_08----------------------#' |
| 222 |
########################################################################### |
| 223 |
# Check if global and session variable are independent of each other # |
| 224 |
########################################################################### |
| 225 |
|
| 226 |
SET @@global.updatable_views_with_limit = NO; |
| 227 |
SET @@session.updatable_views_with_limit = YES; |
| 228 |
SELECT @@updatable_views_with_limit = @@global.updatable_views_with_limit; |
| 229 |
|
| 230 |
|
| 231 |
--echo '#---------------------FN_DYNVARS_001_09----------------------#' |
| 232 |
######################################################################## |
| 233 |
# Check if accessing variable with SESSION,LOCAL and without SCOPE # |
| 234 |
# points to same session variable # |
| 235 |
######################################################################## |
| 236 |
|
| 237 |
SET @@updatable_views_with_limit = YES; |
| 238 |
SELECT @@updatable_views_with_limit = @@local.updatable_views_with_limit; |
| 239 |
SELECT @@local.updatable_views_with_limit = @@session.updatable_views_with_limit; |
| 240 |
|
| 241 |
|
| 242 |
--echo '#---------------------FN_DYNVARS_001_10----------------------#' |
| 243 |
################################################################ |
| 244 |
# Check if variable can be accessed with and without @@ sign # |
| 245 |
################################################################ |
| 246 |
|
| 247 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 248 |
SET updatable_views_with_limit = 1027; |
| 249 |
SELECT @@updatable_views_with_limit; |
| 250 |
|
| 251 |
|
| 252 |
--Error ER_UNKNOWN_TABLE |
| 253 |
SELECT local.updatable_views_with_limit; |
| 254 |
|
| 255 |
--Error ER_UNKNOWN_TABLE |
| 256 |
SELECT session.updatable_views_with_limit; |
| 257 |
|
| 258 |
--Error ER_BAD_FIELD_ERROR |
| 259 |
SELECT updatable_views_with_limit = @@session.updatable_views_with_limit; |
| 260 |
|
| 261 |
|
| 262 |
#################################### |
| 263 |
# Restore initial value # |
| 264 |
#################################### |
| 265 |
|
| 266 |
SET @@global.updatable_views_with_limit = @start_global_value; |
| 267 |
SELECT @@global.updatable_views_with_limit; |
| 268 |
SET @@session.updatable_views_with_limit = @start_session_value; |
| 269 |
SELECT @@session.updatable_views_with_limit; |
| 270 |
|
| 271 |
|
| 272 |
############################################################# |
| 273 |
# END OF updatable_views_with_limit TESTS # |
| 274 |
############################################################# |
| 275 |
|