Skip to content

Commit 9d5902e

Browse files
authored
add auto_increment tests with various types (#3080)
1 parent 40aa5fc commit 9d5902e

File tree

2 files changed

+409
-73
lines changed

2 files changed

+409
-73
lines changed

enginetest/queries/alter_table_queries.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,6 +1456,54 @@ var AlterTableAddAutoIncrementScripts = []ScriptTest{
14561456
},
14571457
},
14581458
},
1459+
{
1460+
Name: "ALTER AUTO INCREMENT TABLE ADD column",
1461+
SetUpScript: []string{
1462+
"CREATE TABLE test (pk int primary key, uk int UNIQUE KEY auto_increment);",
1463+
},
1464+
Assertions: []ScriptTestAssertion{
1465+
{
1466+
Query: "alter table test add column j int;",
1467+
Expected: []sql.Row{{types.NewOkResult(0)}},
1468+
},
1469+
},
1470+
},
1471+
{
1472+
Name: "ALTER TABLE MODIFY column with compound UNIQUE KEYS",
1473+
Dialect: "mysql",
1474+
SetUpScript: []string{
1475+
"CREATE table test (pk int primary key, uk1 int, uk2 int, unique(uk1, uk2))",
1476+
"ALTER TABLE `test` MODIFY column uk1 int auto_increment",
1477+
},
1478+
Assertions: []ScriptTestAssertion{
1479+
{
1480+
Query: "describe test",
1481+
Expected: []sql.Row{
1482+
{"pk", "int", "NO", "PRI", nil, ""},
1483+
{"uk1", "int", "NO", "MUL", nil, "auto_increment"},
1484+
{"uk2", "int", "YES", "", nil, ""},
1485+
},
1486+
},
1487+
},
1488+
},
1489+
{
1490+
Name: "ALTER TABLE MODIFY column with compound KEYS",
1491+
Dialect: "mysql",
1492+
SetUpScript: []string{
1493+
"CREATE table test (pk int primary key, mk1 int, mk2 int, index(mk1, mk2))",
1494+
"ALTER TABLE `test` MODIFY column mk1 int auto_increment",
1495+
},
1496+
Assertions: []ScriptTestAssertion{
1497+
{
1498+
Query: "describe test",
1499+
Expected: []sql.Row{
1500+
{"pk", "int", "NO", "PRI", nil, ""},
1501+
{"mk1", "int", "NO", "MUL", nil, "auto_increment"},
1502+
{"mk2", "int", "YES", "", nil, ""},
1503+
},
1504+
},
1505+
},
1506+
},
14591507
}
14601508

14611509
var AddDropPrimaryKeyScripts = []ScriptTest{

0 commit comments

Comments
 (0)