| 1 |
############## mysql-test\t\unique_checks_basic.test ########################## |
| 2 |
# # |
| 3 |
# Variable Name: unique_checks # |
| 4 |
# Scope: 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 Cases of Dynamic System Variable unique_checks # |
| 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_UNIQUE_CHECKS # |
| 23 |
# # |
| 24 |
############################################################################### |
| 25 |
|
| 26 |
--source include/load_sysvars.inc |
| 27 |
######################################################################## |
| 28 |
# START OF transaction_allow_batching TESTS # |
| 29 |
######################################################################## |
| 30 |
|
| 31 |
|
| 32 |
############################################################# |
| 33 |
# Save initial value # |
| 34 |
############################################################# |
| 35 |
|
| 36 |
SET @start_session_value = @@session.unique_checks; |
| 37 |
SELECT @start_session_value; |
| 38 |
|
| 39 |
--echo '#--------------------FN_DYNVARS_005_01-------------------------#' |
| 40 |
############################################################ |
| 41 |
# Display the DEFAULT value of unique_checks # |
| 42 |
############################################################ |
| 43 |
|
| 44 |
|
| 45 |
SET @@session.unique_checks= 1; |
| 46 |
SET @@session.unique_checks= DEFAULT; |
| 47 |
SELECT @@session.unique_checks; |
| 48 |
|
| 49 |
--echo '#--------------------FN_DYNVARS_005_04-------------------------#' |
| 50 |
######################################################################## |
| 51 |
# Change the value of unique_checks to a valid value for SESSION Scope # |
| 52 |
######################################################################## |
| 53 |
|
| 54 |
SET @@session.unique_checks =1; |
| 55 |
SELECT @@session.unique_checks; |
| 56 |
|
| 57 |
SET @@session.unique_checks = 0; |
| 58 |
SELECT @@session.unique_checks; |
| 59 |
|
| 60 |
SET @@session.unique_checks = True; |
| 61 |
SELECT @@session.unique_checks; |
| 62 |
|
| 63 |
SET @@session.unique_checks = False; |
| 64 |
SELECT @@session.unique_checks; |
| 65 |
|
| 66 |
SET @@session.unique_checks = "ON"; |
| 67 |
SELECT @@session.unique_checks; |
| 68 |
|
| 69 |
SET @@session.unique_checks = "OFF"; |
| 70 |
SELECT @@session.unique_checks; |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
--echo '#------------------FN_DYNVARS_005_05-----------------------#' |
| 75 |
########################################################### |
| 76 |
# Change the value of 'unique_checks' to an invalid value # |
| 77 |
########################################################### |
| 78 |
|
| 79 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 80 |
SET @@session.unique_checks = 'No'; |
| 81 |
|
| 82 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 83 |
SET @@session.unique_checks = "yes"; |
| 84 |
|
| 85 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 86 |
SET @@session.unique_checks = yes; |
| 87 |
|
| 88 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 89 |
SET @@session.unique_checks = NO; |
| 90 |
|
| 91 |
|
| 92 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 93 |
SET @@session.unique_checks = "True"; |
| 94 |
|
| 95 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 96 |
SET @@session.unique_checks = "False"; |
| 97 |
|
| 98 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 99 |
SET @@session.unique_checks = "Test"; |
| 100 |
|
| 101 |
|
| 102 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 103 |
SET @@session.unique_checks = 'test'; |
| 104 |
|
| 105 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 106 |
SET @@session.unique_checks = 123456789031; |
| 107 |
|
| 108 |
|
| 109 |
--echo '#------------------FN_DYNVARS_005_07-----------------------#' |
| 110 |
#################################################################### |
| 111 |
# Check if the value in SESSION Table matches value in variable # |
| 112 |
#################################################################### |
| 113 |
|
| 114 |
--disable_warnings |
| 115 |
SELECT IF(@@session.unique_checks, "ON", "OFF") = VARIABLE_VALUE |
| 116 |
FROM performance_schema.session_variables |
| 117 |
WHERE VARIABLE_NAME='unique_checks'; |
| 118 |
--enable_warnings |
| 119 |
|
| 120 |
|
| 121 |
--echo '#---------------------FN_DYNVARS_001_08----------------------#' |
| 122 |
######################################################################## |
| 123 |
# Check if accessing variable with SESSION,LOCAL and without SCOPE # |
| 124 |
# points to same session variable # |
| 125 |
######################################################################## |
| 126 |
SET @@unique_checks = 1; |
| 127 |
SELECT @@unique_checks = @@local.unique_checks; |
| 128 |
SELECT @@local.unique_checks = @@session.unique_checks; |
| 129 |
|
| 130 |
|
| 131 |
--echo '#---------------------FN_DYNVARS_001_09----------------------#' |
| 132 |
######################################################################## |
| 133 |
# Check if unique_checks can be accessed with and without @@ sign # |
| 134 |
######################################################################## |
| 135 |
|
| 136 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 137 |
SET unique_checks = 1027; |
| 138 |
SELECT @@unique_checks; |
| 139 |
|
| 140 |
--Error ER_UNKNOWN_TABLE |
| 141 |
SELECT local.unique_checks; |
| 142 |
|
| 143 |
--Error ER_UNKNOWN_TABLE |
| 144 |
SELECT session.unique_checks; |
| 145 |
|
| 146 |
--Error ER_BAD_FIELD_ERROR |
| 147 |
SELECT unique_checks = @@session.unique_checks; |
| 148 |
|
| 149 |
|
| 150 |
#################################### |
| 151 |
# Restore initial value # |
| 152 |
#################################### |
| 153 |
|
| 154 |
|
| 155 |
SET @@session.unique_checks = @start_session_value; |
| 156 |
SELECT @@session.unique_checks; |
| 157 |
|
| 158 |
|
| 159 |
################################################## |
| 160 |
# END OF unique_checks TESTS # |
| 161 |
################################################## |
| 162 |
|