Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions enginetest/queries/insert_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -1513,6 +1513,23 @@ var InsertScripts = []ScriptTest{
},
},
},
{
Name: "Insert into unique key that overlaps with primary key",
SetUpScript: []string{
"CREATE TABLE t (pk1 int, pk2 int, col int, PRIMARY KEY(pk1, pk2), UNIQUE KEY(col, pk2));",
"INSERT into t (pk1, pk2, col) VALUES (1, 1, 1), (2, 1, 2);",
},
Assertions: []ScriptTestAssertion{
{
Query: "INSERT INTO t (pk1, pk2, col) VALUES (3, 1, 1);",
ExpectedErr: sql.ErrUniqueKeyViolation,
},
{
Query: "UPDATE t SET col = col + 1",
ExpectedErr: sql.ErrUniqueKeyViolation,
},
},
},
}

var InsertErrorTests = []GenericErrorQueryTest{
Expand Down