@@ -10400,59 +10400,287 @@ where
10400
10400
10401
10401
// Int Tests
10402
10402
{
10403
+ // https://github.com/dolthub/dolt/issues/9530
10403
10404
Name : "int with auto_increment" ,
10404
10405
Dialect : "mysql" ,
10405
10406
SetUpScript : []string {
10406
- "create table int_tbl (i int primary key auto_increment);" ,
10407
10407
"create table tinyint_tbl (i tinyint primary key auto_increment);" ,
10408
10408
"create table smallint_tbl (i smallint primary key auto_increment);" ,
10409
10409
"create table mediumint_tbl (i mediumint primary key auto_increment);" ,
10410
+ "create table int_tbl (i int primary key auto_increment);" ,
10410
10411
"create table bigint_tbl (i bigint primary key auto_increment);" ,
10411
10412
},
10412
10413
Assertions : []ScriptTestAssertion {
10413
10414
{
10415
+ Skip : true ,
10416
+ Query : "insert into tinyint_tbl values (999)" ,
10417
+ ExpectedErr : sql .ErrValueOutOfRange ,
10418
+ },
10419
+ {
10420
+ Skip : true ,
10421
+ Query : "insert into tinyint_tbl values (127)" ,
10422
+ Expected : []sql.Row {
10423
+ {types.OkResult {
10424
+ RowsAffected : 1 ,
10425
+ InsertID : 127 ,
10426
+ }},
10427
+ },
10428
+ },
10429
+ {
10430
+ Skip : true ,
10431
+ Query : "show create table tinyint_tbl;" ,
10432
+ Expected : []sql.Row {
10433
+ {"tinyint_tbl" , "CREATE TABLE `tinyint_tbl` (\n " +
10434
+ " `i` tinyint NOT NULL AUTO_INCREMENT,\n " +
10435
+ " PRIMARY KEY (`i`)\n " +
10436
+ ") ENGINE=InnoDB AUTO_INCREMENT=127 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
10437
+ },
10438
+ },
10439
+
10440
+ {
10441
+ Skip : true ,
10442
+ Query : "insert into smallint_tbl values (99999);" ,
10443
+ ExpectedErr : sql .ErrValueOutOfRange ,
10444
+ },
10445
+ {
10446
+ Skip : true ,
10447
+ Query : "insert into smallint_tbl values (32767);" ,
10448
+ Expected : []sql.Row {
10449
+ {types.OkResult {
10450
+ RowsAffected : 1 ,
10451
+ InsertID : 32767 ,
10452
+ }},
10453
+ },
10454
+ },
10455
+ {
10456
+ Skip : true ,
10457
+ Query : "show create table smallint_tbl;" ,
10458
+ Expected : []sql.Row {
10459
+ {"smallint_tbl" , "CREATE TABLE `smallint_tbl` (\n " +
10460
+ " `i` smallint NOT NULL AUTO_INCREMENT,\n " +
10461
+ " PRIMARY KEY (`i`)\n " +
10462
+ ") ENGINE=InnoDB AUTO_INCREMENT=36727 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
10463
+ },
10464
+ },
10465
+
10466
+ {
10467
+ Skip : true ,
10468
+ Query : "insert into mediumint_tbl values (99999999);" ,
10469
+ ExpectedErr : sql .ErrValueOutOfRange ,
10470
+ },
10471
+ {
10472
+ Skip : true ,
10473
+ Query : "insert into mediumint_tbl values (8388607);" ,
10474
+ Expected : []sql.Row {
10475
+ {types.OkResult {
10476
+ RowsAffected : 1 ,
10477
+ InsertID : 8388607 ,
10478
+ }},
10479
+ },
10480
+ },
10481
+ {
10482
+ Skip : true ,
10483
+ Query : "show create table mediumint_tbl;" ,
10484
+ Expected : []sql.Row {
10485
+ {"mediumint_tbl" , "CREATE TABLE `mediumint_tbl` (\n " +
10486
+ " `i` mediumint NOT NULL AUTO_INCREMENT,\n " +
10487
+ " PRIMARY KEY (`i`)\n " +
10488
+ ") ENGINE=InnoDB AUTO_INCREMENT=8388607 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
10489
+ },
10490
+ },
10491
+
10492
+ {
10493
+ Skip : true ,
10494
+ Query : "insert into int_tbl values (99999999999)" ,
10495
+ ExpectedErr : sql .ErrValueOutOfRange ,
10496
+ },
10497
+ {
10498
+ Skip : true ,
10499
+ Query : "insert into int_tbl values (2147483647)" ,
10500
+ Expected : []sql.Row {
10501
+ {types.OkResult {
10502
+ RowsAffected : 1 ,
10503
+ InsertID : 2147483647 ,
10504
+ }},
10505
+ },
10506
+ },
10507
+ {
10508
+ Skip : true ,
10414
10509
Query : "show create table int_tbl;" ,
10415
10510
Expected : []sql.Row {
10416
10511
{"int_tbl" , "CREATE TABLE `int_tbl` (\n " +
10417
10512
" `i` int NOT NULL AUTO_INCREMENT,\n " +
10418
10513
" PRIMARY KEY (`i`)\n " +
10419
- ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
10514
+ ") ENGINE=InnoDB AUTO_INCREMENT=2147483647 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
10515
+ },
10516
+ },
10517
+
10518
+ {
10519
+ Skip : true ,
10520
+ Query : "insert into bigint_tbl values (99999999999999999999);" ,
10521
+ ExpectedErr : sql .ErrValueOutOfRange ,
10522
+ },
10523
+ {
10524
+ Skip : true ,
10525
+ Query : "insert into bigint_tbl values (9223372036854775807);" ,
10526
+ Expected : []sql.Row {
10527
+ {types.OkResult {
10528
+ RowsAffected : 1 ,
10529
+ InsertID : 9223372036854775807 ,
10530
+ }},
10531
+ },
10532
+ },
10533
+ {
10534
+ Skip : true ,
10535
+ Query : "show create table bigint_tbl;" ,
10536
+ Expected : []sql.Row {
10537
+ {"bigint_tbl" , "CREATE TABLE `bigint_tbl` (\n " +
10538
+ " `i` bigint NOT NULL AUTO_INCREMENT,\n " +
10539
+ " PRIMARY KEY (`i`)\n " +
10540
+ ") ENGINE=InnoDB AUTO_INCREMENT=9223372036854775807 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
10541
+ },
10542
+ },
10543
+ },
10544
+ },
10545
+ {
10546
+ // https://github.com/dolthub/dolt/issues/9530
10547
+ Name : "unsigned int with auto_increment" ,
10548
+ Dialect : "mysql" ,
10549
+ SetUpScript : []string {
10550
+ "create table tinyint_tbl (i tinyint unsigned primary key auto_increment);" ,
10551
+ "create table smallint_tbl (i smallint unsigned primary key auto_increment);" ,
10552
+ "create table mediumint_tbl (i mediumint unsigned primary key auto_increment);" ,
10553
+ "create table int_tbl (i int unsigned primary key auto_increment);" ,
10554
+ "create table bigint_tbl (i bigint unsigned primary key auto_increment);" ,
10555
+ },
10556
+ Assertions : []ScriptTestAssertion {
10557
+ {
10558
+ Skip : true ,
10559
+ Query : "insert into tinyint_tbl values (999)" ,
10560
+ ExpectedErr : sql .ErrValueOutOfRange ,
10561
+ },
10562
+ {
10563
+ Skip : true ,
10564
+ Query : "insert into tinyint_tbl values (255)" ,
10565
+ Expected : []sql.Row {
10566
+ {types.OkResult {
10567
+ RowsAffected : 1 ,
10568
+ InsertID : 255 ,
10569
+ }},
10420
10570
},
10421
10571
},
10422
10572
{
10573
+ Skip : true ,
10423
10574
Query : "show create table tinyint_tbl;" ,
10424
10575
Expected : []sql.Row {
10425
10576
{"tinyint_tbl" , "CREATE TABLE `tinyint_tbl` (\n " +
10426
10577
" `i` tinyint NOT NULL AUTO_INCREMENT,\n " +
10427
10578
" PRIMARY KEY (`i`)\n " +
10428
- ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
10579
+ ") ENGINE=InnoDB AUTO_INCREMENT=255 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
10580
+ },
10581
+ },
10582
+
10583
+ {
10584
+ Skip : true ,
10585
+ Query : "insert into smallint_tbl values (99999);" ,
10586
+ ExpectedErr : sql .ErrValueOutOfRange ,
10587
+ },
10588
+ {
10589
+ Skip : true ,
10590
+ Query : "insert into smallint_tbl values (65535);" ,
10591
+ Expected : []sql.Row {
10592
+ {types.OkResult {
10593
+ RowsAffected : 1 ,
10594
+ InsertID : 65535 ,
10595
+ }},
10429
10596
},
10430
10597
},
10431
10598
{
10599
+ Skip : true ,
10432
10600
Query : "show create table smallint_tbl;" ,
10433
10601
Expected : []sql.Row {
10434
10602
{"smallint_tbl" , "CREATE TABLE `smallint_tbl` (\n " +
10435
10603
" `i` smallint NOT NULL AUTO_INCREMENT,\n " +
10436
10604
" PRIMARY KEY (`i`)\n " +
10437
- ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
10605
+ ") ENGINE=InnoDB AUTO_INCREMENT=65535 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
10606
+ },
10607
+ },
10608
+
10609
+ {
10610
+ Skip : true ,
10611
+ Query : "insert into mediumint_tbl values (999999999);" ,
10612
+ ExpectedErr : sql .ErrValueOutOfRange ,
10613
+ },
10614
+ {
10615
+ Skip : true ,
10616
+ Query : "insert into mediumint_tbl values (16777215);" ,
10617
+ Expected : []sql.Row {
10618
+ {types.OkResult {
10619
+ RowsAffected : 1 ,
10620
+ InsertID : 16777215 ,
10621
+ }},
10438
10622
},
10439
10623
},
10440
10624
{
10625
+ Skip : true ,
10441
10626
Query : "show create table mediumint_tbl;" ,
10442
10627
Expected : []sql.Row {
10443
10628
{"mediumint_tbl" , "CREATE TABLE `mediumint_tbl` (\n " +
10444
10629
" `i` mediumint NOT NULL AUTO_INCREMENT,\n " +
10445
10630
" PRIMARY KEY (`i`)\n " +
10446
- ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
10631
+ ") ENGINE=InnoDB AUTO_INCREMENT=16777215 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
10632
+ },
10633
+ },
10634
+
10635
+ {
10636
+ Skip : true ,
10637
+ Query : "insert into int_tbl values (99999999999)" ,
10638
+ ExpectedErr : sql .ErrValueOutOfRange ,
10639
+ },
10640
+ {
10641
+ Skip : true ,
10642
+ Query : "insert into int_tbl values (4294967295)" ,
10643
+ Expected : []sql.Row {
10644
+ {types.OkResult {
10645
+ RowsAffected : 1 ,
10646
+ InsertID : 4294967295 ,
10647
+ }},
10447
10648
},
10448
10649
},
10449
10650
{
10651
+ Skip : true ,
10652
+ Query : "show create table int_tbl;" ,
10653
+ Expected : []sql.Row {
10654
+ {"int_tbl" , "CREATE TABLE `int_tbl` (\n " +
10655
+ " `i` int NOT NULL AUTO_INCREMENT,\n " +
10656
+ " PRIMARY KEY (`i`)\n " +
10657
+ ") ENGINE=InnoDB AUTO_INCREMENT=4294967295 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
10658
+ },
10659
+ },
10660
+
10661
+ {
10662
+ Skip : true ,
10663
+ Query : "insert into bigint_tbl values (999999999999999999999);" ,
10664
+ ExpectedErr : sql .ErrValueOutOfRange ,
10665
+ },
10666
+ {
10667
+ Skip : true ,
10668
+ Query : "insert into bigint_tbl values (18446744073709551615);" ,
10669
+ Expected : []sql.Row {
10670
+ {types.OkResult {
10671
+ RowsAffected : 1 ,
10672
+ InsertID : 18446744073709551615 ,
10673
+ }},
10674
+ },
10675
+ },
10676
+ {
10677
+ Skip : true ,
10450
10678
Query : "show create table bigint_tbl;" ,
10451
10679
Expected : []sql.Row {
10452
10680
{"bigint_tbl" , "CREATE TABLE `bigint_tbl` (\n " +
10453
10681
" `i` bigint NOT NULL AUTO_INCREMENT,\n " +
10454
10682
" PRIMARY KEY (`i`)\n " +
10455
- ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
10683
+ ") ENGINE=InnoDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
10456
10684
},
10457
10685
},
10458
10686
},
0 commit comments