summaryrefslogtreecommitdiff
path: root/storage/rocksdb/mysql-test/rocksdb/r/autoinc_vars.result
blob: cc47ceff7ca45a97c70f0eceb3fee5b1189a7b48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
DROP TABLE IF EXISTS t1;
#---------------------------
# auto_increment_offset
#---------------------------
SET auto_increment_offset = 200;
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb;
INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b'),(NULL,'c');
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1
SELECT a,b FROM t1 ORDER BY a;
a	b
1	a
2	b
3	c
#---------------------------
# auto_increment_increment
#---------------------------
SET auto_increment_increment = 300;
INSERT INTO t1 (a,b) VALUES (NULL,'d'),(NULL,'e'),(NULL,'f');
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
200
SELECT a,b FROM t1 ORDER BY a;
a	b
1	a
2	b
3	c
200	d
500	e
800	f
SET auto_increment_increment = 50;
INSERT INTO t1 (a,b) VALUES (NULL,'g'),(NULL,'h'),(NULL,'i');
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
850
SELECT a,b FROM t1 ORDER BY a;
a	b
1	a
2	b
3	c
200	d
500	e
800	f
850	g
900	h
950	i
DROP TABLE t1;
#---------------------------
# offset is greater than the max value
#---------------------------
SET auto_increment_increment = 500;
SET auto_increment_offset = 300;
CREATE TABLE t1 (a TINYINT AUTO_INCREMENT PRIMARY KEY) ENGINE=rocksdb;
# In MariaDB, this is an error:
INSERT INTO t1 (a) VALUES (NULL);
ERROR 22003: Out of range value for column 'a' at row 1
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
850
SELECT a FROM t1 ORDER BY a;
a
DROP TABLE t1;
#---------------------------
# test large autoincrement values
#---------------------------
SET auto_increment_increment = 1;
SET auto_increment_offset = 1;
CREATE TABLE t1 (a BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb;
INSERT INTO t1 VALUES (18446744073709551613, 'a');
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `b` char(8) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=ROCKSDB AUTO_INCREMENT=18446744073709551614 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (NULL, 'b');
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `b` char(8) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=ROCKSDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (NULL, 'c');
ERROR HY000: Failed to read auto-increment value from storage engine
SELECT * FROM t1;
a	b
18446744073709551613	a
18446744073709551614	b
DROP TABLE t1;
SET auto_increment_increment = 300;
CREATE TABLE t1 (a BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb;
INSERT INTO t1 VALUES (18446744073709551613, 'a');
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `b` char(8) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=ROCKSDB AUTO_INCREMENT=18446744073709551614 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (NULL, 'b');
ERROR HY000: Failed to read auto-increment value from storage engine
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `b` char(8) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=ROCKSDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (NULL, 'c');
ERROR HY000: Failed to read auto-increment value from storage engine
SELECT * FROM t1;
a	b
18446744073709551613	a
DROP TABLE t1;
SET auto_increment_offset = 200;
CREATE TABLE t1 (a BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb;
INSERT INTO t1 VALUES (18446744073709551613, 'a');
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `b` char(8) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=ROCKSDB AUTO_INCREMENT=18446744073709551614 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (NULL, 'b');
ERROR HY000: Failed to read auto-increment value from storage engine
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `b` char(8) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=ROCKSDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (NULL, 'c');
ERROR HY000: Failed to read auto-increment value from storage engine
SELECT * FROM t1;
a	b
18446744073709551613	a
DROP TABLE t1;
#----------------------------------
# Issue #792 Crash in autoincrement
#----------------------------------
CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY,C2 CHAR) ENGINE=ROCKSDB;
INSERT INTO t1 VALUES(2177,0);
DROP TABLE t1;
CREATE TABLE t0(c0 BLOB) ENGINE=ROCKSDB;
INSERT INTO t0 VALUES(0);
ALTER TABLE t0 AUTO_INCREMENT=0;
DROP TABLE t0;
#---------------------------------------------------------------
# MDEV-16703 Assertion failed in load_auto_incr_value_from_index
#---------------------------------------------------------------
CREATE TABLE t1 (pk INT AUTO_INCREMENT, a INT, PRIMARY KEY(pk)) ENGINE=RocksDB;
INSERT INTO t1 (a) VALUES (1);
UPDATE t1 SET pk = 3;
ALTER TABLE t1 AUTO_INCREMENT 2;
DROP TABLE t1;
#----------------------------------
# Issue #792 Crash in autoincrement
#----------------------------------
CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY,C2 CHAR) ENGINE=ROCKSDB;
INSERT INTO t1 VALUES(2177,0);
DROP TABLE t1;
CREATE TABLE t0(c0 BLOB) ENGINE=ROCKSDB;
INSERT INTO t0 VALUES(0);
ALTER TABLE t0 AUTO_INCREMENT=0;
DROP TABLE t0;
#----------------------------------
# Issue #869 Crash in autoincrement
#----------------------------------
CREATE TABLE t1 (pk INT AUTO_INCREMENT, a INT, PRIMARY KEY(pk)) ENGINE=RocksDB;
INSERT INTO t1 (a) VALUES (1);
UPDATE t1 SET pk = 3;
ALTER TABLE t1 AUTO_INCREMENT 2;
DROP TABLE t1;
#----------------------------------
# Issue #902 Debug assert in autoincrement with small field type
#----------------------------------
SET auto_increment_increment=100, auto_increment_offset=10;
CREATE TABLE t1(i INT AUTO_INCREMENT PRIMARY KEY) ENGINE=ROCKSDB AUTO_INCREMENT=18446744073709551615;
INSERT INTO t1 VALUES (NULL);
ERROR HY000: Failed to read auto-increment value from storage engine
SELECT * FROM t1;
i
ALTER TABLE t1 AUTO_INCREMENT=1;
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1;
i
10
ALTER TABLE t1 AUTO_INCREMENT=18446744073709551615;
INSERT INTO t1 VALUES (NULL);
ERROR HY000: Failed to read auto-increment value from storage engine
SELECT * FROM t1;
i
10
DROP TABLE t1;