| 1 |
--echo ndb_import tests with missing-ai-column option |
| 2 |
SET @session_ai_prefetch_sz = @@session.ndb_autoincrement_prefetch_sz; |
| 3 |
set session ndb_autoincrement_prefetch_sz=16; |
| 4 |
Test the auto inc column type with tinyint |
| 5 |
Auto increment coulumn being the primary key |
| 6 |
create table t1 (a tinyint not null auto_increment primary key, b int, c bigint) engine ndb; |
| 7 |
create table t1ver like t1; |
| 8 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 9 |
AUTO_INCREMENT |
| 10 |
11 |
| 11 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 12 |
AUTO_INCREMENT |
| 13 |
1025 |
| 14 |
select count(*) from t1ver; |
| 15 |
count(*) |
| 16 |
10 |
| 17 |
select count(*) from t1; |
| 18 |
count(*) |
| 19 |
10 |
| 20 |
select count(*) from t1 x, t1ver y |
| 21 |
where x.b = y.b; |
| 22 |
count(*) |
| 23 |
10 |
| 24 |
drop table t1, t1ver; |
| 25 |
Auto increment coulumn being a part of the primary key |
| 26 |
create table t1 (a int, b tinyint not null auto_increment, c bigint, primary key(a, b)) engine ndb; |
| 27 |
create table t1ver like t1; |
| 28 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 29 |
AUTO_INCREMENT |
| 30 |
11 |
| 31 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 32 |
AUTO_INCREMENT |
| 33 |
2049 |
| 34 |
select count(*) from t1ver; |
| 35 |
count(*) |
| 36 |
10 |
| 37 |
select count(*) from t1; |
| 38 |
count(*) |
| 39 |
10 |
| 40 |
select count(*) from t1 x, t1ver y |
| 41 |
where x.a = y.a; |
| 42 |
count(*) |
| 43 |
10 |
| 44 |
drop table t1, t1ver; |
| 45 |
Auto increment coulumn NOT being a part of the primary key |
| 46 |
create table t1 (a int primary key, b tinyint not null auto_increment, c bigint, key(b)) engine ndb; |
| 47 |
create table t1ver like t1; |
| 48 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 49 |
AUTO_INCREMENT |
| 50 |
11 |
| 51 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 52 |
AUTO_INCREMENT |
| 53 |
2049 |
| 54 |
select count(*) from t1ver; |
| 55 |
count(*) |
| 56 |
10 |
| 57 |
select count(*) from t1; |
| 58 |
count(*) |
| 59 |
10 |
| 60 |
select count(*) from t1 x, t1ver y |
| 61 |
where x.a = y.a; |
| 62 |
count(*) |
| 63 |
10 |
| 64 |
drop table t1, t1ver; |
| 65 |
Auto increment coulumn being the last column in a table |
| 66 |
create table t1 (a int, b bigint, c tinyint not null auto_increment primary key) engine ndb; |
| 67 |
create table t1ver like t1; |
| 68 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 69 |
AUTO_INCREMENT |
| 70 |
11 |
| 71 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 72 |
AUTO_INCREMENT |
| 73 |
1025 |
| 74 |
select count(*) from t1ver; |
| 75 |
count(*) |
| 76 |
10 |
| 77 |
select count(*) from t1; |
| 78 |
count(*) |
| 79 |
10 |
| 80 |
select count(*) from t1 x, t1ver y |
| 81 |
where x.b = y.b; |
| 82 |
count(*) |
| 83 |
10 |
| 84 |
drop table t1, t1ver; |
| 85 |
Test the auto inc column type with tinyint unsigned |
| 86 |
Auto increment coulumn being the primary key |
| 87 |
create table t1 (a tinyint unsigned not null auto_increment primary key, b int, c bigint) engine ndb; |
| 88 |
create table t1ver like t1; |
| 89 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 90 |
AUTO_INCREMENT |
| 91 |
11 |
| 92 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 93 |
AUTO_INCREMENT |
| 94 |
1025 |
| 95 |
select count(*) from t1ver; |
| 96 |
count(*) |
| 97 |
10 |
| 98 |
select count(*) from t1; |
| 99 |
count(*) |
| 100 |
10 |
| 101 |
select count(*) from t1 x, t1ver y |
| 102 |
where x.b = y.b; |
| 103 |
count(*) |
| 104 |
10 |
| 105 |
drop table t1, t1ver; |
| 106 |
Auto increment coulumn being a part of the primary key |
| 107 |
create table t1 (a int, b tinyint unsigned not null auto_increment, c bigint, primary key(a, b)) engine ndb; |
| 108 |
create table t1ver like t1; |
| 109 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 110 |
AUTO_INCREMENT |
| 111 |
11 |
| 112 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 113 |
AUTO_INCREMENT |
| 114 |
2049 |
| 115 |
select count(*) from t1ver; |
| 116 |
count(*) |
| 117 |
10 |
| 118 |
select count(*) from t1; |
| 119 |
count(*) |
| 120 |
10 |
| 121 |
select count(*) from t1 x, t1ver y |
| 122 |
where x.a = y.a; |
| 123 |
count(*) |
| 124 |
10 |
| 125 |
drop table t1, t1ver; |
| 126 |
Auto increment coulumn NOT being a part of the primary key |
| 127 |
create table t1 (a int primary key, b tinyint unsigned not null auto_increment, c bigint, key(b)) engine ndb; |
| 128 |
create table t1ver like t1; |
| 129 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 130 |
AUTO_INCREMENT |
| 131 |
11 |
| 132 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 133 |
AUTO_INCREMENT |
| 134 |
2049 |
| 135 |
select count(*) from t1ver; |
| 136 |
count(*) |
| 137 |
10 |
| 138 |
select count(*) from t1; |
| 139 |
count(*) |
| 140 |
10 |
| 141 |
select count(*) from t1 x, t1ver y |
| 142 |
where x.a = y.a; |
| 143 |
count(*) |
| 144 |
10 |
| 145 |
drop table t1, t1ver; |
| 146 |
Auto increment coulumn being the last column in a table |
| 147 |
create table t1 (a int, b bigint, c tinyint unsigned not null auto_increment primary key) engine ndb; |
| 148 |
create table t1ver like t1; |
| 149 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 150 |
AUTO_INCREMENT |
| 151 |
11 |
| 152 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 153 |
AUTO_INCREMENT |
| 154 |
1025 |
| 155 |
select count(*) from t1ver; |
| 156 |
count(*) |
| 157 |
10 |
| 158 |
select count(*) from t1; |
| 159 |
count(*) |
| 160 |
10 |
| 161 |
select count(*) from t1 x, t1ver y |
| 162 |
where x.b = y.b; |
| 163 |
count(*) |
| 164 |
10 |
| 165 |
drop table t1, t1ver; |
| 166 |
Test the auto inc column type with smallint |
| 167 |
Auto increment coulumn being the primary key |
| 168 |
create table t1 (a smallint not null auto_increment primary key, b int, c bigint) engine ndb; |
| 169 |
create table t1ver like t1; |
| 170 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 171 |
AUTO_INCREMENT |
| 172 |
11 |
| 173 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 174 |
AUTO_INCREMENT |
| 175 |
1025 |
| 176 |
select count(*) from t1ver; |
| 177 |
count(*) |
| 178 |
10 |
| 179 |
select count(*) from t1; |
| 180 |
count(*) |
| 181 |
10 |
| 182 |
select count(*) from t1 x, t1ver y |
| 183 |
where x.b = y.b; |
| 184 |
count(*) |
| 185 |
10 |
| 186 |
drop table t1, t1ver; |
| 187 |
Auto increment coulumn being a part of the primary key |
| 188 |
create table t1 (a int, b smallint not null auto_increment, c bigint, primary key(a, b)) engine ndb; |
| 189 |
create table t1ver like t1; |
| 190 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 191 |
AUTO_INCREMENT |
| 192 |
11 |
| 193 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 194 |
AUTO_INCREMENT |
| 195 |
2049 |
| 196 |
select count(*) from t1ver; |
| 197 |
count(*) |
| 198 |
10 |
| 199 |
select count(*) from t1; |
| 200 |
count(*) |
| 201 |
10 |
| 202 |
select count(*) from t1 x, t1ver y |
| 203 |
where x.a = y.a; |
| 204 |
count(*) |
| 205 |
10 |
| 206 |
drop table t1, t1ver; |
| 207 |
Auto increment coulumn NOT being a part of the primary key |
| 208 |
create table t1 (a int primary key, b smallint not null auto_increment, c bigint, key(b)) engine ndb; |
| 209 |
create table t1ver like t1; |
| 210 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 211 |
AUTO_INCREMENT |
| 212 |
11 |
| 213 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 214 |
AUTO_INCREMENT |
| 215 |
2049 |
| 216 |
select count(*) from t1ver; |
| 217 |
count(*) |
| 218 |
10 |
| 219 |
select count(*) from t1; |
| 220 |
count(*) |
| 221 |
10 |
| 222 |
select count(*) from t1 x, t1ver y |
| 223 |
where x.a = y.a; |
| 224 |
count(*) |
| 225 |
10 |
| 226 |
drop table t1, t1ver; |
| 227 |
Auto increment coulumn being the last column in a table |
| 228 |
create table t1 (a int, b bigint, c smallint not null auto_increment primary key) engine ndb; |
| 229 |
create table t1ver like t1; |
| 230 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 231 |
AUTO_INCREMENT |
| 232 |
11 |
| 233 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 234 |
AUTO_INCREMENT |
| 235 |
1025 |
| 236 |
select count(*) from t1ver; |
| 237 |
count(*) |
| 238 |
10 |
| 239 |
select count(*) from t1; |
| 240 |
count(*) |
| 241 |
10 |
| 242 |
select count(*) from t1 x, t1ver y |
| 243 |
where x.b = y.b; |
| 244 |
count(*) |
| 245 |
10 |
| 246 |
drop table t1, t1ver; |
| 247 |
Test the auto inc column type with smallint unsigned |
| 248 |
Auto increment coulumn being the primary key |
| 249 |
create table t1 (a smallint unsigned not null auto_increment primary key, b int, c bigint) engine ndb; |
| 250 |
create table t1ver like t1; |
| 251 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 252 |
AUTO_INCREMENT |
| 253 |
11 |
| 254 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 255 |
AUTO_INCREMENT |
| 256 |
1025 |
| 257 |
select count(*) from t1ver; |
| 258 |
count(*) |
| 259 |
10 |
| 260 |
select count(*) from t1; |
| 261 |
count(*) |
| 262 |
10 |
| 263 |
select count(*) from t1 x, t1ver y |
| 264 |
where x.b = y.b; |
| 265 |
count(*) |
| 266 |
10 |
| 267 |
drop table t1, t1ver; |
| 268 |
Auto increment coulumn being a part of the primary key |
| 269 |
create table t1 (a int, b smallint unsigned not null auto_increment, c bigint, primary key(a, b)) engine ndb; |
| 270 |
create table t1ver like t1; |
| 271 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 272 |
AUTO_INCREMENT |
| 273 |
11 |
| 274 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 275 |
AUTO_INCREMENT |
| 276 |
2049 |
| 277 |
select count(*) from t1ver; |
| 278 |
count(*) |
| 279 |
10 |
| 280 |
select count(*) from t1; |
| 281 |
count(*) |
| 282 |
10 |
| 283 |
select count(*) from t1 x, t1ver y |
| 284 |
where x.a = y.a; |
| 285 |
count(*) |
| 286 |
10 |
| 287 |
drop table t1, t1ver; |
| 288 |
Auto increment coulumn NOT being a part of the primary key |
| 289 |
create table t1 (a int primary key, b smallint unsigned not null auto_increment, c bigint, key(b)) engine ndb; |
| 290 |
create table t1ver like t1; |
| 291 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 292 |
AUTO_INCREMENT |
| 293 |
11 |
| 294 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 295 |
AUTO_INCREMENT |
| 296 |
2049 |
| 297 |
select count(*) from t1ver; |
| 298 |
count(*) |
| 299 |
10 |
| 300 |
select count(*) from t1; |
| 301 |
count(*) |
| 302 |
10 |
| 303 |
select count(*) from t1 x, t1ver y |
| 304 |
where x.a = y.a; |
| 305 |
count(*) |
| 306 |
10 |
| 307 |
drop table t1, t1ver; |
| 308 |
Auto increment coulumn being the last column in a table |
| 309 |
create table t1 (a int, b bigint, c smallint unsigned not null auto_increment primary key) engine ndb; |
| 310 |
create table t1ver like t1; |
| 311 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 312 |
AUTO_INCREMENT |
| 313 |
11 |
| 314 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 315 |
AUTO_INCREMENT |
| 316 |
1025 |
| 317 |
select count(*) from t1ver; |
| 318 |
count(*) |
| 319 |
10 |
| 320 |
select count(*) from t1; |
| 321 |
count(*) |
| 322 |
10 |
| 323 |
select count(*) from t1 x, t1ver y |
| 324 |
where x.b = y.b; |
| 325 |
count(*) |
| 326 |
10 |
| 327 |
drop table t1, t1ver; |
| 328 |
set session ndb_autoincrement_prefetch_sz=@session_ai_prefetch_sz; |
| 329 |
Test the auto inc column type with mediumint |
| 330 |
Auto increment coulumn being the primary key |
| 331 |
create table t1 (a mediumint not null auto_increment primary key, b int, c bigint) engine ndb; |
| 332 |
create table t1ver like t1; |
| 333 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 334 |
AUTO_INCREMENT |
| 335 |
11 |
| 336 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 337 |
AUTO_INCREMENT |
| 338 |
1025 |
| 339 |
select count(*) from t1ver; |
| 340 |
count(*) |
| 341 |
10 |
| 342 |
select count(*) from t1; |
| 343 |
count(*) |
| 344 |
10 |
| 345 |
select count(*) from t1 x, t1ver y |
| 346 |
where x.b = y.b; |
| 347 |
count(*) |
| 348 |
10 |
| 349 |
drop table t1, t1ver; |
| 350 |
Auto increment coulumn being a part of the primary key |
| 351 |
create table t1 (a int, b mediumint not null auto_increment, c bigint, primary key(a, b)) engine ndb; |
| 352 |
create table t1ver like t1; |
| 353 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 354 |
AUTO_INCREMENT |
| 355 |
11 |
| 356 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 357 |
AUTO_INCREMENT |
| 358 |
2049 |
| 359 |
select count(*) from t1ver; |
| 360 |
count(*) |
| 361 |
10 |
| 362 |
select count(*) from t1; |
| 363 |
count(*) |
| 364 |
10 |
| 365 |
select count(*) from t1 x, t1ver y |
| 366 |
where x.a = y.a; |
| 367 |
count(*) |
| 368 |
10 |
| 369 |
drop table t1, t1ver; |
| 370 |
Auto increment coulumn NOT being a part of the primary key |
| 371 |
create table t1 (a int primary key, b mediumint not null auto_increment, c bigint, key(b)) engine ndb; |
| 372 |
create table t1ver like t1; |
| 373 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 374 |
AUTO_INCREMENT |
| 375 |
11 |
| 376 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 377 |
AUTO_INCREMENT |
| 378 |
2049 |
| 379 |
select count(*) from t1ver; |
| 380 |
count(*) |
| 381 |
10 |
| 382 |
select count(*) from t1; |
| 383 |
count(*) |
| 384 |
10 |
| 385 |
select count(*) from t1 x, t1ver y |
| 386 |
where x.a = y.a; |
| 387 |
count(*) |
| 388 |
10 |
| 389 |
drop table t1, t1ver; |
| 390 |
Auto increment coulumn being the last column in a table |
| 391 |
create table t1 (a int, b bigint, c mediumint not null auto_increment primary key) engine ndb; |
| 392 |
create table t1ver like t1; |
| 393 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 394 |
AUTO_INCREMENT |
| 395 |
11 |
| 396 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 397 |
AUTO_INCREMENT |
| 398 |
1025 |
| 399 |
select count(*) from t1ver; |
| 400 |
count(*) |
| 401 |
10 |
| 402 |
select count(*) from t1; |
| 403 |
count(*) |
| 404 |
10 |
| 405 |
select count(*) from t1 x, t1ver y |
| 406 |
where x.b = y.b; |
| 407 |
count(*) |
| 408 |
10 |
| 409 |
drop table t1, t1ver; |
| 410 |
Test the auto inc column type with mediumint unsigned |
| 411 |
Auto increment coulumn being the primary key |
| 412 |
create table t1 (a mediumint unsigned not null auto_increment primary key, b int, c bigint) engine ndb; |
| 413 |
create table t1ver like t1; |
| 414 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 415 |
AUTO_INCREMENT |
| 416 |
11 |
| 417 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 418 |
AUTO_INCREMENT |
| 419 |
1025 |
| 420 |
select count(*) from t1ver; |
| 421 |
count(*) |
| 422 |
10 |
| 423 |
select count(*) from t1; |
| 424 |
count(*) |
| 425 |
10 |
| 426 |
select count(*) from t1 x, t1ver y |
| 427 |
where x.b = y.b; |
| 428 |
count(*) |
| 429 |
10 |
| 430 |
drop table t1, t1ver; |
| 431 |
Auto increment coulumn being a part of the primary key |
| 432 |
create table t1 (a int, b mediumint unsigned not null auto_increment, c bigint, primary key(a, b)) engine ndb; |
| 433 |
create table t1ver like t1; |
| 434 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 435 |
AUTO_INCREMENT |
| 436 |
11 |
| 437 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 438 |
AUTO_INCREMENT |
| 439 |
2049 |
| 440 |
select count(*) from t1ver; |
| 441 |
count(*) |
| 442 |
10 |
| 443 |
select count(*) from t1; |
| 444 |
count(*) |
| 445 |
10 |
| 446 |
select count(*) from t1 x, t1ver y |
| 447 |
where x.a = y.a; |
| 448 |
count(*) |
| 449 |
10 |
| 450 |
drop table t1, t1ver; |
| 451 |
Auto increment coulumn NOT being a part of the primary key |
| 452 |
create table t1 (a int primary key, b mediumint unsigned not null auto_increment, c bigint, key(b)) engine ndb; |
| 453 |
create table t1ver like t1; |
| 454 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 455 |
AUTO_INCREMENT |
| 456 |
11 |
| 457 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 458 |
AUTO_INCREMENT |
| 459 |
2049 |
| 460 |
select count(*) from t1ver; |
| 461 |
count(*) |
| 462 |
10 |
| 463 |
select count(*) from t1; |
| 464 |
count(*) |
| 465 |
10 |
| 466 |
select count(*) from t1 x, t1ver y |
| 467 |
where x.a = y.a; |
| 468 |
count(*) |
| 469 |
10 |
| 470 |
drop table t1, t1ver; |
| 471 |
Auto increment coulumn being the last column in a table |
| 472 |
create table t1 (a int, b bigint, c mediumint unsigned not null auto_increment primary key) engine ndb; |
| 473 |
create table t1ver like t1; |
| 474 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 475 |
AUTO_INCREMENT |
| 476 |
11 |
| 477 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 478 |
AUTO_INCREMENT |
| 479 |
1025 |
| 480 |
select count(*) from t1ver; |
| 481 |
count(*) |
| 482 |
10 |
| 483 |
select count(*) from t1; |
| 484 |
count(*) |
| 485 |
10 |
| 486 |
select count(*) from t1 x, t1ver y |
| 487 |
where x.b = y.b; |
| 488 |
count(*) |
| 489 |
10 |
| 490 |
drop table t1, t1ver; |
| 491 |
Test the auto inc column type with int |
| 492 |
Auto increment coulumn being the primary key |
| 493 |
create table t1 (a int not null auto_increment primary key, b int, c bigint) engine ndb; |
| 494 |
create table t1ver like t1; |
| 495 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 496 |
AUTO_INCREMENT |
| 497 |
11 |
| 498 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 499 |
AUTO_INCREMENT |
| 500 |
1025 |
| 501 |
select count(*) from t1ver; |
| 502 |
count(*) |
| 503 |
10 |
| 504 |
select count(*) from t1; |
| 505 |
count(*) |
| 506 |
10 |
| 507 |
select count(*) from t1 x, t1ver y |
| 508 |
where x.b = y.b; |
| 509 |
count(*) |
| 510 |
10 |
| 511 |
drop table t1, t1ver; |
| 512 |
Auto increment coulumn being a part of the primary key |
| 513 |
create table t1 (a int, b int not null auto_increment, c bigint, primary key(a, b)) engine ndb; |
| 514 |
create table t1ver like t1; |
| 515 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 516 |
AUTO_INCREMENT |
| 517 |
11 |
| 518 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 519 |
AUTO_INCREMENT |
| 520 |
2049 |
| 521 |
select count(*) from t1ver; |
| 522 |
count(*) |
| 523 |
10 |
| 524 |
select count(*) from t1; |
| 525 |
count(*) |
| 526 |
10 |
| 527 |
select count(*) from t1 x, t1ver y |
| 528 |
where x.a = y.a; |
| 529 |
count(*) |
| 530 |
10 |
| 531 |
drop table t1, t1ver; |
| 532 |
Auto increment coulumn NOT being a part of the primary key |
| 533 |
create table t1 (a int primary key, b int not null auto_increment, c bigint, key(b)) engine ndb; |
| 534 |
create table t1ver like t1; |
| 535 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 536 |
AUTO_INCREMENT |
| 537 |
11 |
| 538 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 539 |
AUTO_INCREMENT |
| 540 |
2049 |
| 541 |
select count(*) from t1ver; |
| 542 |
count(*) |
| 543 |
10 |
| 544 |
select count(*) from t1; |
| 545 |
count(*) |
| 546 |
10 |
| 547 |
select count(*) from t1 x, t1ver y |
| 548 |
where x.a = y.a; |
| 549 |
count(*) |
| 550 |
10 |
| 551 |
drop table t1, t1ver; |
| 552 |
Auto increment coulumn being the last column in a table |
| 553 |
create table t1 (a int, b bigint, c int not null auto_increment primary key) engine ndb; |
| 554 |
create table t1ver like t1; |
| 555 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 556 |
AUTO_INCREMENT |
| 557 |
11 |
| 558 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 559 |
AUTO_INCREMENT |
| 560 |
1025 |
| 561 |
select count(*) from t1ver; |
| 562 |
count(*) |
| 563 |
10 |
| 564 |
select count(*) from t1; |
| 565 |
count(*) |
| 566 |
10 |
| 567 |
select count(*) from t1 x, t1ver y |
| 568 |
where x.b = y.b; |
| 569 |
count(*) |
| 570 |
10 |
| 571 |
drop table t1, t1ver; |
| 572 |
Test the auto inc column type with int unsigned |
| 573 |
Auto increment coulumn being the primary key |
| 574 |
create table t1 (a int unsigned not null auto_increment primary key, b int, c bigint) engine ndb; |
| 575 |
create table t1ver like t1; |
| 576 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 577 |
AUTO_INCREMENT |
| 578 |
11 |
| 579 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 580 |
AUTO_INCREMENT |
| 581 |
1025 |
| 582 |
select count(*) from t1ver; |
| 583 |
count(*) |
| 584 |
10 |
| 585 |
select count(*) from t1; |
| 586 |
count(*) |
| 587 |
10 |
| 588 |
select count(*) from t1 x, t1ver y |
| 589 |
where x.b = y.b; |
| 590 |
count(*) |
| 591 |
10 |
| 592 |
drop table t1, t1ver; |
| 593 |
Auto increment coulumn being a part of the primary key |
| 594 |
create table t1 (a int, b int unsigned not null auto_increment, c bigint, primary key(a, b)) engine ndb; |
| 595 |
create table t1ver like t1; |
| 596 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 597 |
AUTO_INCREMENT |
| 598 |
11 |
| 599 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 600 |
AUTO_INCREMENT |
| 601 |
2049 |
| 602 |
select count(*) from t1ver; |
| 603 |
count(*) |
| 604 |
10 |
| 605 |
select count(*) from t1; |
| 606 |
count(*) |
| 607 |
10 |
| 608 |
select count(*) from t1 x, t1ver y |
| 609 |
where x.a = y.a; |
| 610 |
count(*) |
| 611 |
10 |
| 612 |
drop table t1, t1ver; |
| 613 |
Auto increment coulumn NOT being a part of the primary key |
| 614 |
create table t1 (a int primary key, b int unsigned not null auto_increment, c bigint, key(b)) engine ndb; |
| 615 |
create table t1ver like t1; |
| 616 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 617 |
AUTO_INCREMENT |
| 618 |
11 |
| 619 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 620 |
AUTO_INCREMENT |
| 621 |
2049 |
| 622 |
select count(*) from t1ver; |
| 623 |
count(*) |
| 624 |
10 |
| 625 |
select count(*) from t1; |
| 626 |
count(*) |
| 627 |
10 |
| 628 |
select count(*) from t1 x, t1ver y |
| 629 |
where x.a = y.a; |
| 630 |
count(*) |
| 631 |
10 |
| 632 |
drop table t1, t1ver; |
| 633 |
Auto increment coulumn being the last column in a table |
| 634 |
create table t1 (a int, b bigint, c int unsigned not null auto_increment primary key) engine ndb; |
| 635 |
create table t1ver like t1; |
| 636 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 637 |
AUTO_INCREMENT |
| 638 |
11 |
| 639 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 640 |
AUTO_INCREMENT |
| 641 |
1025 |
| 642 |
select count(*) from t1ver; |
| 643 |
count(*) |
| 644 |
10 |
| 645 |
select count(*) from t1; |
| 646 |
count(*) |
| 647 |
10 |
| 648 |
select count(*) from t1 x, t1ver y |
| 649 |
where x.b = y.b; |
| 650 |
count(*) |
| 651 |
10 |
| 652 |
drop table t1, t1ver; |
| 653 |
Test the auto inc column type with bigint |
| 654 |
Auto increment coulumn being the primary key |
| 655 |
create table t1 (a bigint not null auto_increment primary key, b int, c bigint) engine ndb; |
| 656 |
create table t1ver like t1; |
| 657 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 658 |
AUTO_INCREMENT |
| 659 |
11 |
| 660 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 661 |
AUTO_INCREMENT |
| 662 |
1025 |
| 663 |
select count(*) from t1ver; |
| 664 |
count(*) |
| 665 |
10 |
| 666 |
select count(*) from t1; |
| 667 |
count(*) |
| 668 |
10 |
| 669 |
select count(*) from t1 x, t1ver y |
| 670 |
where x.b = y.b; |
| 671 |
count(*) |
| 672 |
10 |
| 673 |
drop table t1, t1ver; |
| 674 |
Auto increment coulumn being a part of the primary key |
| 675 |
create table t1 (a int, b bigint not null auto_increment, c bigint, primary key(a, b)) engine ndb; |
| 676 |
create table t1ver like t1; |
| 677 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 678 |
AUTO_INCREMENT |
| 679 |
11 |
| 680 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 681 |
AUTO_INCREMENT |
| 682 |
2049 |
| 683 |
select count(*) from t1ver; |
| 684 |
count(*) |
| 685 |
10 |
| 686 |
select count(*) from t1; |
| 687 |
count(*) |
| 688 |
10 |
| 689 |
select count(*) from t1 x, t1ver y |
| 690 |
where x.a = y.a; |
| 691 |
count(*) |
| 692 |
10 |
| 693 |
drop table t1, t1ver; |
| 694 |
Auto increment coulumn NOT being a part of the primary key |
| 695 |
create table t1 (a int primary key, b bigint not null auto_increment, c bigint, key(b)) engine ndb; |
| 696 |
create table t1ver like t1; |
| 697 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 698 |
AUTO_INCREMENT |
| 699 |
11 |
| 700 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 701 |
AUTO_INCREMENT |
| 702 |
2049 |
| 703 |
select count(*) from t1ver; |
| 704 |
count(*) |
| 705 |
10 |
| 706 |
select count(*) from t1; |
| 707 |
count(*) |
| 708 |
10 |
| 709 |
select count(*) from t1 x, t1ver y |
| 710 |
where x.a = y.a; |
| 711 |
count(*) |
| 712 |
10 |
| 713 |
drop table t1, t1ver; |
| 714 |
Auto increment coulumn being the last column in a table |
| 715 |
create table t1 (a int, b bigint, c bigint not null auto_increment primary key) engine ndb; |
| 716 |
create table t1ver like t1; |
| 717 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 718 |
AUTO_INCREMENT |
| 719 |
11 |
| 720 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 721 |
AUTO_INCREMENT |
| 722 |
1025 |
| 723 |
select count(*) from t1ver; |
| 724 |
count(*) |
| 725 |
10 |
| 726 |
select count(*) from t1; |
| 727 |
count(*) |
| 728 |
10 |
| 729 |
select count(*) from t1 x, t1ver y |
| 730 |
where x.b = y.b; |
| 731 |
count(*) |
| 732 |
10 |
| 733 |
drop table t1, t1ver; |
| 734 |
Test the auto inc column type with bigint unsigned |
| 735 |
Auto increment coulumn being the primary key |
| 736 |
create table t1 (a bigint unsigned not null auto_increment primary key, b int, c bigint) engine ndb; |
| 737 |
create table t1ver like t1; |
| 738 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 739 |
AUTO_INCREMENT |
| 740 |
11 |
| 741 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 742 |
AUTO_INCREMENT |
| 743 |
1025 |
| 744 |
select count(*) from t1ver; |
| 745 |
count(*) |
| 746 |
10 |
| 747 |
select count(*) from t1; |
| 748 |
count(*) |
| 749 |
10 |
| 750 |
select count(*) from t1 x, t1ver y |
| 751 |
where x.b = y.b; |
| 752 |
count(*) |
| 753 |
10 |
| 754 |
drop table t1, t1ver; |
| 755 |
Auto increment coulumn being a part of the primary key |
| 756 |
create table t1 (a int, b bigint unsigned not null auto_increment, c bigint, primary key(a, b)) engine ndb; |
| 757 |
create table t1ver like t1; |
| 758 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 759 |
AUTO_INCREMENT |
| 760 |
11 |
| 761 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 762 |
AUTO_INCREMENT |
| 763 |
2049 |
| 764 |
select count(*) from t1ver; |
| 765 |
count(*) |
| 766 |
10 |
| 767 |
select count(*) from t1; |
| 768 |
count(*) |
| 769 |
10 |
| 770 |
select count(*) from t1 x, t1ver y |
| 771 |
where x.a = y.a; |
| 772 |
count(*) |
| 773 |
10 |
| 774 |
drop table t1, t1ver; |
| 775 |
Auto increment coulumn NOT being a part of the primary key |
| 776 |
create table t1 (a int primary key, b bigint unsigned not null auto_increment, c bigint, key(b)) engine ndb; |
| 777 |
create table t1ver like t1; |
| 778 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 779 |
AUTO_INCREMENT |
| 780 |
11 |
| 781 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 782 |
AUTO_INCREMENT |
| 783 |
2049 |
| 784 |
select count(*) from t1ver; |
| 785 |
count(*) |
| 786 |
10 |
| 787 |
select count(*) from t1; |
| 788 |
count(*) |
| 789 |
10 |
| 790 |
select count(*) from t1 x, t1ver y |
| 791 |
where x.a = y.a; |
| 792 |
count(*) |
| 793 |
10 |
| 794 |
drop table t1, t1ver; |
| 795 |
Auto increment coulumn being the last column in a table |
| 796 |
create table t1 (a int, b bigint, c bigint unsigned not null auto_increment primary key) engine ndb; |
| 797 |
create table t1ver like t1; |
| 798 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1ver"; |
| 799 |
AUTO_INCREMENT |
| 800 |
11 |
| 801 |
select AUTO_INCREMENT from information_schema.tables where table_schema="test" and table_name="t1"; |
| 802 |
AUTO_INCREMENT |
| 803 |
1025 |
| 804 |
select count(*) from t1ver; |
| 805 |
count(*) |
| 806 |
10 |
| 807 |
select count(*) from t1; |
| 808 |
count(*) |
| 809 |
10 |
| 810 |
select count(*) from t1 x, t1ver y |
| 811 |
where x.b = y.b; |
| 812 |
count(*) |
| 813 |
10 |
| 814 |
drop table t1, t1ver; |
| 815 |
Test that missing-ai-column option requires an explicit auto increment column |
| 816 |
create table t1 (a int not null primary key, b int, c bigint) engine ndb; |
| 817 |
drop table t1; |
| 818 |
Test that missing-ai-column option works with multiple tables |
| 819 |
create table t1 (a int not null auto_increment primary key, b int, c bigint) engine ndb; |
| 820 |
create table t2 (a int not null auto_increment primary key, b int, c bigint) engine ndb; |
| 821 |
select count(*) from t1; |
| 822 |
count(*) |
| 823 |
10 |
| 824 |
select count(*) from t2; |
| 825 |
count(*) |
| 826 |
2 |
| 827 |
drop table t1; |
| 828 |
drop table t2; |