Merge pull request #4512 from dolthub/james/unique

Tests for unique index creation on keyless tables
This commit is contained in:
James Cor
2022-10-11 19:48:30 -07:00
committed by GitHub
4 changed files with 27 additions and 3 deletions

View File

@@ -57,7 +57,7 @@ require (
require (
github.com/aliyun/aliyun-oss-go-sdk v2.2.5+incompatible
github.com/cenkalti/backoff/v4 v4.1.3
github.com/dolthub/go-mysql-server v0.12.1-0.20221011050424-bea6a2cba32a
github.com/dolthub/go-mysql-server v0.12.1-0.20221011165907-6f67b89b5a2f
github.com/google/flatbuffers v2.0.6+incompatible
github.com/kch42/buzhash v0.0.0-20160816060738-9bdec3dec7c6
github.com/mitchellh/go-ps v1.0.0

View File

@@ -178,8 +178,8 @@ github.com/dolthub/flatbuffers v1.13.0-dh.1 h1:OWJdaPep22N52O/0xsUevxJ6Qfw1M2txC
github.com/dolthub/flatbuffers v1.13.0-dh.1/go.mod h1:CorYGaDmXjHz1Z7i50PYXG1Ricn31GcA2wNOTFIQAKE=
github.com/dolthub/fslock v0.0.3 h1:iLMpUIvJKMKm92+N1fmHVdxJP5NdyDK5bK7z7Ba2s2U=
github.com/dolthub/fslock v0.0.3/go.mod h1:QWql+P17oAAMLnL4HGB5tiovtDuAjdDTPbuqx7bYfa0=
github.com/dolthub/go-mysql-server v0.12.1-0.20221011050424-bea6a2cba32a h1:0MLzdX0PcjIaJjqssOCKoDHtl3Uygm1BB9tNK9gSCbo=
github.com/dolthub/go-mysql-server v0.12.1-0.20221011050424-bea6a2cba32a/go.mod h1:9Q9FhWO82GrV4he13V2ZuDE0T/eDZbPVMOWLcZluOvg=
github.com/dolthub/go-mysql-server v0.12.1-0.20221011165907-6f67b89b5a2f h1:e/kkoxegCjG4WFVqaq54RO2Xo6504dlZZeKKeWygCM0=
github.com/dolthub/go-mysql-server v0.12.1-0.20221011165907-6f67b89b5a2f/go.mod h1:9Q9FhWO82GrV4he13V2ZuDE0T/eDZbPVMOWLcZluOvg=
github.com/dolthub/ishell v0.0.0-20220112232610-14e753f0f371 h1:oyPHJlzumKta1vnOQqUnfdz+pk3EmnHS3Nd0cCT0I2g=
github.com/dolthub/ishell v0.0.0-20220112232610-14e753f0f371/go.mod h1:dhGBqcCEfK5kuFmeO5+WOx3hqc1k3M29c1oS/R7N4ms=
github.com/dolthub/jsonpath v0.0.0-20210609232853-d49537a30474 h1:xTrR+l5l+1Lfq0NvhiEsctylXinUMFhhsqaEcl414p8=

View File

@@ -691,3 +691,19 @@ var BrokenDDLScripts = []queries.ScriptTest{
},
},
}
var AddIndexScripts = []queries.ScriptTest{
{
Name: "add unique constraint on keyless table",
SetUpScript: []string{
"CREATE TABLE test (uk int);",
"insert into test values (0), (0)",
},
Assertions: []queries.ScriptTestAssertion{
{
Query: "create unique index m on test (uk);",
ExpectedErr: sql.ErrUniqueKeyViolation,
},
},
},
}

View File

@@ -835,6 +835,14 @@ func TestDoltDdlScripts(t *testing.T) {
require.NoError(t, err)
enginetest.TestScriptWithEngine(t, e, harness, script)
}
if !types.IsFormat_DOLT(types.Format_Default) {
t.Skip("not fixing unique index on keyless tables for old format")
}
for _, script := range AddIndexScripts {
e, err := harness.NewEngine(t)
require.NoError(t, err)
enginetest.TestScriptWithEngine(t, e, harness, script)
}
}
func TestBrokenDdlScripts(t *testing.T) {