Skip to content

Commit 60e98ba

Browse files
authored
add skipped tests for auto_increment and max integer (#3100)
1 parent 21301de commit 60e98ba

File tree

1 file changed

+234
-6
lines changed

1 file changed

+234
-6
lines changed

enginetest/queries/script_queries.go

Lines changed: 234 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10400,59 +10400,287 @@ where
1040010400

1040110401
// Int Tests
1040210402
{
10403+
// https://github.com/dolthub/dolt/issues/9530
1040310404
Name: "int with auto_increment",
1040410405
Dialect: "mysql",
1040510406
SetUpScript: []string{
10406-
"create table int_tbl (i int primary key auto_increment);",
1040710407
"create table tinyint_tbl (i tinyint primary key auto_increment);",
1040810408
"create table smallint_tbl (i smallint primary key auto_increment);",
1040910409
"create table mediumint_tbl (i mediumint primary key auto_increment);",
10410+
"create table int_tbl (i int primary key auto_increment);",
1041010411
"create table bigint_tbl (i bigint primary key auto_increment);",
1041110412
},
1041210413
Assertions: []ScriptTestAssertion{
1041310414
{
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,
1041410509
Query: "show create table int_tbl;",
1041510510
Expected: []sql.Row{
1041610511
{"int_tbl", "CREATE TABLE `int_tbl` (\n" +
1041710512
" `i` int NOT NULL AUTO_INCREMENT,\n" +
1041810513
" 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+
}},
1042010570
},
1042110571
},
1042210572
{
10573+
Skip: true,
1042310574
Query: "show create table tinyint_tbl;",
1042410575
Expected: []sql.Row{
1042510576
{"tinyint_tbl", "CREATE TABLE `tinyint_tbl` (\n" +
1042610577
" `i` tinyint NOT NULL AUTO_INCREMENT,\n" +
1042710578
" 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+
}},
1042910596
},
1043010597
},
1043110598
{
10599+
Skip: true,
1043210600
Query: "show create table smallint_tbl;",
1043310601
Expected: []sql.Row{
1043410602
{"smallint_tbl", "CREATE TABLE `smallint_tbl` (\n" +
1043510603
" `i` smallint NOT NULL AUTO_INCREMENT,\n" +
1043610604
" 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+
}},
1043810622
},
1043910623
},
1044010624
{
10625+
Skip: true,
1044110626
Query: "show create table mediumint_tbl;",
1044210627
Expected: []sql.Row{
1044310628
{"mediumint_tbl", "CREATE TABLE `mediumint_tbl` (\n" +
1044410629
" `i` mediumint NOT NULL AUTO_INCREMENT,\n" +
1044510630
" 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+
}},
1044710648
},
1044810649
},
1044910650
{
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,
1045010678
Query: "show create table bigint_tbl;",
1045110679
Expected: []sql.Row{
1045210680
{"bigint_tbl", "CREATE TABLE `bigint_tbl` (\n" +
1045310681
" `i` bigint NOT NULL AUTO_INCREMENT,\n" +
1045410682
" 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"},
1045610684
},
1045710685
},
1045810686
},

0 commit comments

Comments
 (0)