~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to mysql-test/r/auto_increment_increment_func.result

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
SET @global_auto_increment_increment = @@global.auto_increment_increment;
 
2
SET @session_auto_increment_increment = @@session.auto_increment_increment;
 
3
SET @global_auto_increment_offset = @@global.auto_increment_offset;
 
4
SET @session_auto_increment_offset = @@session.auto_increment_offset;
 
5
drop table if exists t1;
 
6
CREATE TABLE t1
 
7
(
 
8
id INT NOT NULL auto_increment,
 
9
PRIMARY KEY (id),
 
10
name VARCHAR(30)
 
11
);
 
12
'#--------------------FN_DYNVARS_001_01-------------------------#'
 
13
## Setting initial value of auto_increment_increment to 5 ##
 
14
SET @@auto_increment_increment = 5;
 
15
'#--------------------FN_DYNVARS_001_02-------------------------#'
 
16
## Inserting first record in table to check behavior of the variable ##
 
17
INSERT into t1(name) values('Record_1');
 
18
SELECT * from t1;
 
19
id      name
 
20
1       Record_1
 
21
## Changing value of variable to 10 ##
 
22
SET @@global.auto_increment_increment = 10;
 
23
## Inserting record and verifying value of column id ##
 
24
INSERT into t1(name) values('Record_2');
 
25
SELECT * from t1;
 
26
id      name
 
27
1       Record_1
 
28
6       Record_2
 
29
## Test behavior of variable after assigning some larger value to it ##
 
30
SELECT @@auto_increment_increment;
 
31
@@auto_increment_increment
 
32
5
 
33
SET @@auto_increment_increment = 100;
 
34
INSERT into t1(name) values('Record_5');
 
35
SELECT * from t1;
 
36
id      name
 
37
1       Record_1
 
38
6       Record_2
 
39
101     Record_5
 
40
'#--------------------FN_DYNVARS_001_03-------------------------#'
 
41
## Creating new connection test_con1 ##
 
42
## Value of session & global vairable here should be 10 ##
 
43
SELECT @@global.auto_increment_increment = 10;
 
44
@@global.auto_increment_increment = 10
 
45
1
 
46
SELECT @@session.auto_increment_increment = 10;
 
47
@@session.auto_increment_increment = 10
 
48
1
 
49
## Setting global value of variable and inserting data in table ##
 
50
SET @@global.auto_increment_increment = 20;
 
51
SELECT @@global.auto_increment_increment;
 
52
@@global.auto_increment_increment
 
53
20
 
54
INSERT into t1(name) values('Record_6');
 
55
SELECT * from t1;
 
56
id      name
 
57
1       Record_1
 
58
6       Record_2
 
59
101     Record_5
 
60
111     Record_6
 
61
## Setting session value of variable and inserting data in table ##
 
62
SET @@session.auto_increment_increment = 2;
 
63
SELECT @@session.auto_increment_increment;
 
64
@@session.auto_increment_increment
 
65
2
 
66
INSERT into t1(name) values('Record_8');
 
67
INSERT into t1(name) values('Record_9');
 
68
SELECT * from t1;
 
69
id      name
 
70
1       Record_1
 
71
6       Record_2
 
72
101     Record_5
 
73
111     Record_6
 
74
113     Record_8
 
75
115     Record_9
 
76
'#--------------------FN_DYNVARS_001_04-------------------------#'
 
77
## Creating another new connection test_con2 ##
 
78
## Verifying initial values of variable in global & session scope ##
 
79
## global & session initial value should be 20 ##
 
80
SELECT @@global.auto_increment_increment = 20;
 
81
@@global.auto_increment_increment = 20
 
82
1
 
83
SELECT @@session.auto_increment_increment = 20;
 
84
@@session.auto_increment_increment = 20
 
85
1
 
86
## Setting value of session variable to 5 and verifying its behavior ##
 
87
SET @@session.auto_increment_increment = 5;
 
88
INSERT into t1(name) values('Record_10');
 
89
SELECT * from t1;
 
90
id      name
 
91
1       Record_1
 
92
6       Record_2
 
93
101     Record_5
 
94
111     Record_6
 
95
113     Record_8
 
96
115     Record_9
 
97
116     Record_10
 
98
'Bug#35362: Here Record_10 id should be 120 instead of 115 because we'
 
99
'have set the value of variable to 5'
 
100
SET @@session.auto_increment_increment = 1;
 
101
SELECT @@auto_increment_increment;
 
102
@@auto_increment_increment
 
103
1
 
104
SELECT @@global.auto_increment_increment;
 
105
@@global.auto_increment_increment
 
106
20
 
107
'#--------------------FN_DYNVARS_001_05-------------------------#'
 
108
## Switching to test_con1 ##
 
109
## Verifying values of global & session value of variable ##
 
110
## global value should be 20 ##
 
111
SELECT @@global.auto_increment_increment = 20;
 
112
@@global.auto_increment_increment = 20
 
113
1
 
114
## session value should be 2 ##
 
115
SELECT @@session.auto_increment_increment = 2;
 
116
@@session.auto_increment_increment = 2
 
117
1
 
118
INSERT into t1(name) values('Record_11');
 
119
INSERT into t1(name) values('Record_12');
 
120
SELECT * from t1;
 
121
id      name
 
122
1       Record_1
 
123
6       Record_2
 
124
101     Record_5
 
125
111     Record_6
 
126
113     Record_8
 
127
115     Record_9
 
128
116     Record_10
 
129
117     Record_11
 
130
119     Record_12
 
131
'#--------------------FN_DYNVARS_001_06-------------------------#'
 
132
## Changing column's datatype to SmallInt and verifying variable's behavior ##
 
133
ALTER table t1 MODIFY id SMALLINT NOT NULL auto_increment;
 
134
INSERT into t1(name) values('Record_13');
 
135
INSERT into t1(name) values('Record_14');
 
136
SELECT * from t1;
 
137
id      name
 
138
1       Record_1
 
139
6       Record_2
 
140
101     Record_5
 
141
111     Record_6
 
142
113     Record_8
 
143
115     Record_9
 
144
116     Record_10
 
145
117     Record_11
 
146
119     Record_12
 
147
121     Record_13
 
148
123     Record_14
 
149
## Changing column's datatype to BigInt and verifying variable's behavior ##
 
150
ALTER table t1 MODIFY id BIGINT NOT NULL auto_increment;
 
151
INSERT into t1(name) values('Record_15');
 
152
INSERT into t1(name) values('Record_16');
 
153
SELECT * from t1;
 
154
id      name
 
155
1       Record_1
 
156
6       Record_2
 
157
101     Record_5
 
158
111     Record_6
 
159
113     Record_8
 
160
115     Record_9
 
161
116     Record_10
 
162
117     Record_11
 
163
119     Record_12
 
164
121     Record_13
 
165
123     Record_14
 
166
125     Record_15
 
167
127     Record_16
 
168
'#--------------------FN_DYNVARS_001_07-------------------------#'
 
169
## Verifying behavior of variable with negative value ##
 
170
SET @@auto_increment_increment = -10;
 
171
Warnings:
 
172
Warning 1292    Truncated incorrect auto-increment-increment value: '0'
 
173
INSERT into t1(name) values('Record_17');
 
174
INSERT into t1(name) values('Record_18');
 
175
SELECT * from t1;
 
176
id      name
 
177
1       Record_1
 
178
6       Record_2
 
179
101     Record_5
 
180
111     Record_6
 
181
113     Record_8
 
182
115     Record_9
 
183
116     Record_10
 
184
117     Record_11
 
185
119     Record_12
 
186
121     Record_13
 
187
123     Record_14
 
188
125     Record_15
 
189
127     Record_16
 
190
128     Record_17
 
191
129     Record_18
 
192
'Bug#35364: Variable is incrementing some random values on assigning -ve value'
 
193
## Disconnecting test_con2 ##
 
194
## Dropping table t1 ##
 
195
DROP table if exists t1;
 
196
## Disconnecting test_con1 ##
 
197
## switching to default connection ##
 
198
SET @@global.auto_increment_increment = @global_auto_increment_increment;
 
199
SET @@session.auto_increment_increment = @session_auto_increment_increment;
 
200
SET @@global.auto_increment_offset = @global_auto_increment_offset;
 
201
SET @@session.auto_increment_offset = @session_auto_increment_offset;