1
############## mysql-test\t\unique_checks_basic.test ##########################
3
# Variable Name: unique_checks #
5
# Access Type: Dynamic #
11
# Creation Date: 2008-02-14 #
12
# Author: Sharique Abdullah #
14
# Description: Test Cases of Dynamic System Variable unique_checks #
15
# that checks the behavior of this variable in the following ways#
17
# * Valid & Invalid values #
18
# * Scope & Access method #
21
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
22
# server-system-variables.html#option_mysqld_UNIQUE_CHECKS #
24
###############################################################################
26
--source include/load_sysvars.inc
27
########################################################################
28
# START OF transaction_allow_batching TESTS #
29
########################################################################
32
#############################################################
33
# Save initial value #
34
#############################################################
36
SET @start_session_value = @@session.unique_checks;
37
SELECT @start_session_value;
39
--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
40
############################################################
41
# Display the DEFAULT value of unique_checks #
42
############################################################
45
SET @@session.unique_checks= 1;
46
SET @@session.unique_checks= DEFAULT;
47
SELECT @@session.unique_checks;
49
--echo '#--------------------FN_DYNVARS_005_02-------------------------#'
50
#############################################################
51
# Check the DEFAULT value of unique_checks #
52
#############################################################
55
SET @@session.unique_checks = DEFAULT;
56
SELECT @@session.unique_checks =1;
59
--echo '#--------------------FN_DYNVARS_005_04-------------------------#'
60
########################################################################
61
# Change the value of unique_checks to a valid value for SESSION Scope #
62
########################################################################
64
SET @@session.unique_checks =1;
65
SELECT @@session.unique_checks;
67
SET @@session.unique_checks = 0;
68
SELECT @@session.unique_checks;
70
SET @@session.unique_checks = True;
71
SELECT @@session.unique_checks;
73
SET @@session.unique_checks = False;
74
SELECT @@session.unique_checks;
76
SET @@session.unique_checks = "ON";
77
SELECT @@session.unique_checks;
79
SET @@session.unique_checks = "OFF";
80
SELECT @@session.unique_checks;
84
--echo '#------------------FN_DYNVARS_005_05-----------------------#'
85
###########################################################
86
# Change the value of 'unique_checks' to an invalid value #
87
###########################################################
89
--Error ER_WRONG_VALUE_FOR_VAR
90
SET @@session.unique_checks = 'No';
92
--Error ER_WRONG_VALUE_FOR_VAR
93
SET @@session.unique_checks = "yes";
95
--Error ER_WRONG_VALUE_FOR_VAR
96
SET @@session.unique_checks = yes;
98
--Error ER_WRONG_VALUE_FOR_VAR
99
SET @@session.unique_checks = NO;
102
--Error ER_WRONG_VALUE_FOR_VAR
103
SET @@session.unique_checks = "True";
105
--Error ER_WRONG_VALUE_FOR_VAR
106
SET @@session.unique_checks = "False";
108
--Error ER_WRONG_VALUE_FOR_VAR
109
SET @@session.unique_checks = "Test";
112
--Error ER_WRONG_VALUE_FOR_VAR
113
SET @@session.unique_checks = 'test';
115
--Error ER_WRONG_VALUE_FOR_VAR
116
SET @@session.unique_checks = 123456789031;
119
--echo '#------------------FN_DYNVARS_005_07-----------------------#'
120
####################################################################
121
# Check if the value in SESSION Table matches value in variable #
122
####################################################################
124
SELECT @@session.unique_checks = VARIABLE_VALUE
125
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
126
WHERE VARIABLE_NAME='unique_checks';
129
--echo '#---------------------FN_DYNVARS_001_08----------------------#'
130
########################################################################
131
# Check if accessing variable with SESSION,LOCAL and without SCOPE #
132
# points to same session variable #
133
########################################################################
134
SET @@unique_checks = 1;
135
SELECT @@unique_checks = @@local.unique_checks;
136
SELECT @@local.unique_checks = @@session.unique_checks;
139
--echo '#---------------------FN_DYNVARS_001_09----------------------#'
140
########################################################################
141
# Check if unique_checks can be accessed with and without @@ sign #
142
########################################################################
144
--Error ER_WRONG_VALUE_FOR_VAR
145
SET unique_checks = 1027;
146
SELECT @@unique_checks;
148
--Error ER_UNKNOWN_TABLE
149
SELECT local.unique_checks;
151
--Error ER_UNKNOWN_TABLE
152
SELECT session.unique_checks;
154
--Error ER_BAD_FIELD_ERROR
155
SELECT unique_checks = @@session.unique_checks;
158
####################################
159
# Restore initial value #
160
####################################
163
SET @@session.unique_checks = @start_session_value;
164
SELECT @@session.unique_checks;
167
##################################################
168
# END OF unique_checks TESTS #
169
##################################################