Skip to content

Commit da4365d

Browse files
committed
added auto-increment test queries
1 parent 0657628 commit da4365d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

enginetest/queries/insert_queries.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2277,9 +2277,11 @@ var InsertScripts = []ScriptTest{
22772277
},
22782278
},
22792279
{
2280-
Name: "insert...returning... statements",
2280+
Name: "insert...returning... statements",
2281+
Dialect: "mysql", // actually mariadb
22812282
SetUpScript: []string{
22822283
"CREATE TABLE animals (id int, name varchar(20))",
2284+
"CREATE TABLE auto_pk (`pk` int NOT NULL AUTO_INCREMENT, `name` varchar(20), PRIMARY KEY (`pk`))",
22832285
},
22842286
Assertions: []ScriptTestAssertion{
22852287
{
@@ -2294,6 +2296,14 @@ var InsertScripts = []ScriptTest{
22942296
Query: "insert into animals set id=1,name='Bear' returning id,name",
22952297
Expected: []sql.Row{{1, "Bear"}},
22962298
},
2299+
{
2300+
Query: "insert into auto_pk (name) values ('Cat') returning pk,name",
2301+
Expected: []sql.Row{{1, "Cat"}},
2302+
},
2303+
{
2304+
Query: "insert into auto_pk values (NULL, 'Dog'),(5, 'Fish'),(NULL, 'Horse') returning pk,name",
2305+
Expected: []sql.Row{{2, "Dog"}, {5, "Fish"}, {6, "Horse"}},
2306+
},
22972307
},
22982308
},
22992309
}

0 commit comments

Comments
 (0)