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_04-------------------------#'
50
########################################################################
51
# Change the value of unique_checks to a valid value for SESSION Scope #
52
########################################################################
54
SET @@session.unique_checks =1;
55
SELECT @@session.unique_checks;
57
SET @@session.unique_checks = 0;
58
SELECT @@session.unique_checks;
60
SET @@session.unique_checks = True;
61
SELECT @@session.unique_checks;
63
SET @@session.unique_checks = False;
64
SELECT @@session.unique_checks;
66
SET @@session.unique_checks = "ON";
67
SELECT @@session.unique_checks;
69
SET @@session.unique_checks = "OFF";
70
SELECT @@session.unique_checks;
74
--echo '#------------------FN_DYNVARS_005_05-----------------------#'
75
###########################################################
76
# Change the value of 'unique_checks' to an invalid value #
77
###########################################################
79
--Error ER_WRONG_VALUE_FOR_VAR
80
SET @@session.unique_checks = 'No';
82
--Error ER_WRONG_VALUE_FOR_VAR
83
SET @@session.unique_checks = "yes";
85
--Error ER_WRONG_VALUE_FOR_VAR
86
SET @@session.unique_checks = yes;
88
--Error ER_WRONG_VALUE_FOR_VAR
89
SET @@session.unique_checks = NO;
92
--Error ER_WRONG_VALUE_FOR_VAR
93
SET @@session.unique_checks = "True";
95
--Error ER_WRONG_VALUE_FOR_VAR
96
SET @@session.unique_checks = "False";
98
--Error ER_WRONG_VALUE_FOR_VAR
99
SET @@session.unique_checks = "Test";
102
--Error ER_WRONG_VALUE_FOR_VAR
103
SET @@session.unique_checks = 'test';
105
--Error ER_WRONG_VALUE_FOR_VAR
106
SET @@session.unique_checks = 123456789031;
109
--echo '#------------------FN_DYNVARS_005_07-----------------------#'
110
####################################################################
111
# Check if the value in SESSION Table matches value in variable #
112
####################################################################
114
SELECT IF(@@session.unique_checks, "ON", "OFF") = VARIABLE_VALUE
115
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
116
WHERE VARIABLE_NAME='unique_checks';
119
--echo '#---------------------FN_DYNVARS_001_08----------------------#'
120
########################################################################
121
# Check if accessing variable with SESSION,LOCAL and without SCOPE #
122
# points to same session variable #
123
########################################################################
124
SET @@unique_checks = 1;
125
SELECT @@unique_checks = @@local.unique_checks;
126
SELECT @@local.unique_checks = @@session.unique_checks;
129
--echo '#---------------------FN_DYNVARS_001_09----------------------#'
130
########################################################################
131
# Check if unique_checks can be accessed with and without @@ sign #
132
########################################################################
134
--Error ER_WRONG_VALUE_FOR_VAR
135
SET unique_checks = 1027;
136
SELECT @@unique_checks;
138
--Error ER_UNKNOWN_TABLE
139
SELECT local.unique_checks;
141
--Error ER_UNKNOWN_TABLE
142
SELECT session.unique_checks;
144
--Error ER_BAD_FIELD_ERROR
145
SELECT unique_checks = @@session.unique_checks;
148
####################################
149
# Restore initial value #
150
####################################
153
SET @@session.unique_checks = @start_session_value;
154
SELECT @@session.unique_checks;
157
##################################################
158
# END OF unique_checks TESTS #
159
##################################################