mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-21 02:57:46 -05:00
fixing edge case with bounds, and moving tests over to gms
This commit is contained in:
@@ -58,7 +58,7 @@ require (
|
||||
github.com/cenkalti/backoff/v4 v4.1.3
|
||||
github.com/cespare/xxhash v1.1.0
|
||||
github.com/creasty/defaults v1.6.0
|
||||
github.com/dolthub/go-mysql-server v0.14.1-0.20221114182009-bf520f36202a
|
||||
github.com/dolthub/go-mysql-server v0.14.1-0.20221115223305-bccd27cd1501
|
||||
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
|
||||
|
||||
@@ -180,8 +180,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.14.1-0.20221114182009-bf520f36202a h1:ekqXdZRHO1JCJjrDHZA2y21Y9firwF+EwtL0oZ3Xgrw=
|
||||
github.com/dolthub/go-mysql-server v0.14.1-0.20221114182009-bf520f36202a/go.mod h1:KtpU4Sf7J+SIat/nxoA733QTn3tdL34NtoGxEBFcTsA=
|
||||
github.com/dolthub/go-mysql-server v0.14.1-0.20221115223305-bccd27cd1501 h1:cI9MKhZ5R4TATuLqBsN7Hl94jJOmex4LJaIWmRCl7XY=
|
||||
github.com/dolthub/go-mysql-server v0.14.1-0.20221115223305-bccd27cd1501/go.mod h1:KtpU4Sf7J+SIat/nxoA733QTn3tdL34NtoGxEBFcTsA=
|
||||
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=
|
||||
|
||||
@@ -8125,750 +8125,6 @@ var DoltCommitTests = []queries.ScriptTest{
|
||||
}
|
||||
|
||||
var DoltIndexPrefixScripts = []queries.ScriptTest{
|
||||
{
|
||||
Name: "varchar primary key prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (v varchar(100))",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add primary key (v(10))",
|
||||
ExpectedErr: sql.ErrUnsupportedIndexPrefix,
|
||||
},
|
||||
{
|
||||
Query: "create table v_tbl (v varchar(100), primary key (v(10)))",
|
||||
ExpectedErr: sql.ErrUnsupportedIndexPrefix,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "varchar keyed secondary index prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (i int primary key, v varchar(10))",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add unique index (v(1))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table t",
|
||||
Expected: []sql.Row{{"t", "CREATE TABLE `t` (\n `i` int NOT NULL,\n `v` varchar(10),\n PRIMARY KEY (`i`),\n UNIQUE KEY `v` (`v`(1))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values (0, 'aa'), (1, 'ab')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "insert into t values (0, 'aa'), (1, 'bb'), (2, 'cc')",
|
||||
Expected: []sql.Row{{sql.NewOkResult(3)}},
|
||||
},
|
||||
{
|
||||
Query: "select * from t where v = 'a'",
|
||||
Expected: []sql.Row{},
|
||||
},
|
||||
{
|
||||
Query: "select * from t where v = 'aa'",
|
||||
Expected: []sql.Row{
|
||||
{0, "aa"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "create table v_tbl (i int primary key, v varchar(100), index (v(10)))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table v_tbl",
|
||||
Expected: []sql.Row{{"v_tbl", "CREATE TABLE `v_tbl` (\n `i` int NOT NULL,\n `v` varchar(100),\n PRIMARY KEY (`i`),\n KEY `v` (`v`(10))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "varchar keyless secondary index prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (v varchar(10))",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add unique index (v(1))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table t",
|
||||
Expected: []sql.Row{{"t", "CREATE TABLE `t` (\n `v` varchar(10),\n UNIQUE KEY `v` (`v`(1))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values ('aa'), ('ab')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "create table v_tbl (v varchar(100), index (v(10)))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table v_tbl",
|
||||
Expected: []sql.Row{{"v_tbl", "CREATE TABLE `v_tbl` (\n `v` varchar(100),\n KEY `v` (`v`(10))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "char primary key prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (c char(100))",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add primary key (c(10))",
|
||||
ExpectedErr: sql.ErrUnsupportedIndexPrefix,
|
||||
},
|
||||
{
|
||||
Query: "create table c_tbl (c char(100), primary key (c(10)))",
|
||||
ExpectedErr: sql.ErrUnsupportedIndexPrefix,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "char keyed secondary index prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (i int primary key, c char(10))",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add unique index (c(1))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table t",
|
||||
Expected: []sql.Row{{"t", "CREATE TABLE `t` (\n `i` int NOT NULL,\n `c` char(10),\n PRIMARY KEY (`i`),\n UNIQUE KEY `c` (`c`(1))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values (0, 'aa'), (1, 'ab')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "create table c_tbl (i int primary key, c varchar(100), index (c(10)))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table c_tbl",
|
||||
Expected: []sql.Row{{"c_tbl", "CREATE TABLE `c_tbl` (\n `i` int NOT NULL,\n `c` varchar(100),\n PRIMARY KEY (`i`),\n KEY `c` (`c`(10))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "char keyless secondary index prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (c char(10))",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add unique index (c(1))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table t",
|
||||
Expected: []sql.Row{{"t", "CREATE TABLE `t` (\n `c` char(10),\n UNIQUE KEY `c` (`c`(1))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values ('aa'), ('ab')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "create table c_tbl (c char(100), index (c(10)))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table c_tbl",
|
||||
Expected: []sql.Row{{"c_tbl", "CREATE TABLE `c_tbl` (\n `c` char(100),\n KEY `c` (`c`(10))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "varbinary primary key prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (v varbinary(100))",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add primary key (v(10))",
|
||||
ExpectedErr: sql.ErrUnsupportedIndexPrefix,
|
||||
},
|
||||
{
|
||||
Query: "create table v_tbl (v varbinary(100), primary key (v(10)))",
|
||||
ExpectedErr: sql.ErrUnsupportedIndexPrefix,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "varbinary keyed secondary index prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (i int primary key, v varbinary(10))",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add unique index (v(1))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table t",
|
||||
Expected: []sql.Row{{"t", "CREATE TABLE `t` (\n `i` int NOT NULL,\n `v` varbinary(10),\n PRIMARY KEY (`i`),\n UNIQUE KEY `v` (`v`(1))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values (0, 'aa'), (1, 'ab')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "create table v_tbl (i int primary key, v varbinary(100), index (v(10)))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table v_tbl",
|
||||
Expected: []sql.Row{{"v_tbl", "CREATE TABLE `v_tbl` (\n `i` int NOT NULL,\n `v` varbinary(100),\n PRIMARY KEY (`i`),\n KEY `v` (`v`(10))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "varbinary keyless secondary index prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (v varbinary(10))",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add unique index (v(1))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table t",
|
||||
Expected: []sql.Row{{"t", "CREATE TABLE `t` (\n `v` varbinary(10),\n UNIQUE KEY `v` (`v`(1))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values ('aa'), ('ab')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "create table v_tbl (v varbinary(100), index (v(10)))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table v_tbl",
|
||||
Expected: []sql.Row{{"v_tbl", "CREATE TABLE `v_tbl` (\n `v` varbinary(100),\n KEY `v` (`v`(10))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "binary primary key prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (b binary(100))",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add primary key (b(10))",
|
||||
ExpectedErr: sql.ErrUnsupportedIndexPrefix,
|
||||
},
|
||||
{
|
||||
Query: "create table b_tbl (b binary(100), primary key (b(10)))",
|
||||
ExpectedErr: sql.ErrUnsupportedIndexPrefix,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "binary keyed secondary index prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (i int primary key, b binary(10))",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add unique index (b(1))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table t",
|
||||
Expected: []sql.Row{{"t", "CREATE TABLE `t` (\n `i` int NOT NULL,\n `b` binary(10),\n PRIMARY KEY (`i`),\n UNIQUE KEY `b` (`b`(1))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values (0, 'aa'), (1, 'ab')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "create table b_tbl (i int primary key, b binary(100), index (b(10)))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table b_tbl",
|
||||
Expected: []sql.Row{{"b_tbl", "CREATE TABLE `b_tbl` (\n `i` int NOT NULL,\n `b` binary(100),\n PRIMARY KEY (`i`),\n KEY `b` (`b`(10))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "binary keyless secondary index prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (b binary(10))",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add unique index (b(1))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table t",
|
||||
Expected: []sql.Row{{"t", "CREATE TABLE `t` (\n `b` binary(10),\n UNIQUE KEY `b` (`b`(1))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values ('aa'), ('ab')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "create table b_tbl (b binary(100), index (b(10)))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table b_tbl",
|
||||
Expected: []sql.Row{{"b_tbl", "CREATE TABLE `b_tbl` (\n `b` binary(100),\n KEY `b` (`b`(10))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "blob primary key prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (b blob)",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add primary key (b(10))",
|
||||
ExpectedErr: sql.ErrUnsupportedIndexPrefix,
|
||||
},
|
||||
{
|
||||
Query: "create table b_tbl (b blob, primary key (b(10)))",
|
||||
ExpectedErr: sql.ErrUnsupportedIndexPrefix,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "blob keyed secondary index prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (i int primary key, b blob)",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add unique index (b(1))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table t",
|
||||
Expected: []sql.Row{{"t", "CREATE TABLE `t` (\n `i` int NOT NULL,\n `b` blob,\n PRIMARY KEY (`i`),\n UNIQUE KEY `b` (`b`(1))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values (0, 'aa'), (1, 'ab')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "create table b_tbl (i int primary key, b blob, index (b(10)))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table b_tbl",
|
||||
Expected: []sql.Row{{"b_tbl", "CREATE TABLE `b_tbl` (\n `i` int NOT NULL,\n `b` blob,\n PRIMARY KEY (`i`),\n KEY `b` (`b`(10))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "blob keyless secondary index prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (b blob)",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add unique index (b(1))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table t",
|
||||
Expected: []sql.Row{{"t", "CREATE TABLE `t` (\n `b` blob,\n UNIQUE KEY `b` (`b`(1))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values ('aa'), ('ab')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "create table b_tbl (b blob, index (b(10)))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table b_tbl",
|
||||
Expected: []sql.Row{{"b_tbl", "CREATE TABLE `b_tbl` (\n `b` blob,\n KEY `b` (`b`(10))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "text primary key prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (t text)",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add primary key (t(10))",
|
||||
ExpectedErr: sql.ErrUnsupportedIndexPrefix,
|
||||
},
|
||||
{
|
||||
Query: "create table b_tbl (t text, primary key (t(10)))",
|
||||
ExpectedErr: sql.ErrUnsupportedIndexPrefix,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "text keyed secondary index prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (i int primary key, t text)",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add unique index (t(1))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table t",
|
||||
Expected: []sql.Row{{"t", "CREATE TABLE `t` (\n `i` int NOT NULL,\n `t` text,\n PRIMARY KEY (`i`),\n UNIQUE KEY `t` (`t`(1))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values (0, 'aa'), (1, 'ab')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "create table t_tbl (i int primary key, t text, index (t(10)))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table t_tbl",
|
||||
Expected: []sql.Row{{"t_tbl", "CREATE TABLE `t_tbl` (\n `i` int NOT NULL,\n `t` text,\n PRIMARY KEY (`i`),\n KEY `t` (`t`(10))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "text keyless secondary index prefix",
|
||||
SetUpScript: []string{
|
||||
"create table t (t text)",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "alter table t add unique index (t(1))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table t",
|
||||
Expected: []sql.Row{{"t", "CREATE TABLE `t` (\n `t` text,\n UNIQUE KEY `t` (`t`(1))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values ('aa'), ('ab')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "create table t_tbl (t text, index (t(10)))",
|
||||
Expected: []sql.Row{{sql.NewOkResult(0)}},
|
||||
},
|
||||
{
|
||||
Query: "show create table t_tbl",
|
||||
Expected: []sql.Row{{"t_tbl", "CREATE TABLE `t_tbl` (\n `t` text,\n KEY `t` (`t`(10))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "inline secondary indexes",
|
||||
SetUpScript: []string{
|
||||
"create table t (i int primary key, v1 varchar(10), v2 varchar(10), unique index (v1(3),v2(5)))",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "show create table t",
|
||||
Expected: []sql.Row{{"t", "CREATE TABLE `t` (\n `i` int NOT NULL,\n `v1` varchar(10),\n `v2` varchar(10),\n PRIMARY KEY (`i`),\n UNIQUE KEY `v1v2` (`v1`(3),`v2`(5))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values (0, 'a', 'a'), (1, 'ab','ab'), (2, 'abc', 'abc'), (3, 'abcde', 'abcde')",
|
||||
Expected: []sql.Row{{sql.NewOkResult(4)}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values (99, 'abc', 'abcde')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "insert into t values (99, 'abc123', 'abcde123')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "select * from t where v1 = 'a'",
|
||||
Expected: []sql.Row{
|
||||
{0, "a", "a"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "explain select * from t where v1 = 'a'",
|
||||
Expected: []sql.Row{
|
||||
{"Filter(t.v1 = 'a')"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" ├─ filters: [{[a, a], [NULL, ∞)}]"},
|
||||
{" └─ columns: [i v1 v2]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t where v1 = 'abc'",
|
||||
Expected: []sql.Row{
|
||||
{2, "abc", "abc"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "explain select * from t where v1 = 'abc'",
|
||||
Expected: []sql.Row{
|
||||
{"Filter(t.v1 = 'abc')"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" ├─ filters: [{[abc, abc], [NULL, ∞)}]"},
|
||||
{" └─ columns: [i v1 v2]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t where v1 = 'abcd'",
|
||||
Expected: []sql.Row{},
|
||||
},
|
||||
{
|
||||
Query: "explain select * from t where v1 = 'abcd'",
|
||||
Expected: []sql.Row{
|
||||
{"Filter(t.v1 = 'abcd')"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" ├─ filters: [{[abcd, abcd], [NULL, ∞)}]"},
|
||||
{" └─ columns: [i v1 v2]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t where v1 > 'a' and v1 < 'abcde'",
|
||||
Expected: []sql.Row{
|
||||
{1, "ab", "ab"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "explain select * from t where v1 > 'a' and v1 < 'abcde'",
|
||||
Expected: []sql.Row{
|
||||
{"Filter((t.v1 > 'a') AND (t.v1 < 'abcde'))"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" ├─ filters: [{(a, abcde), [NULL, ∞)}]"},
|
||||
{" └─ columns: [i v1 v2]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t where v1 > 'a' and v2 < 'abcde'",
|
||||
Expected: []sql.Row{
|
||||
{1, "ab", "ab"},
|
||||
{2, "abc", "abc"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "explain select * from t where v1 > 'a' and v2 < 'abcde'",
|
||||
Expected: []sql.Row{
|
||||
{"Filter((t.v1 > 'a') AND (t.v2 < 'abcde'))"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" ├─ filters: [{(a, ∞), (NULL, abcde)}]"},
|
||||
{" └─ columns: [i v1 v2]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "update t set v1 = concat(v1, 'z') where v1 >= 'a'",
|
||||
Expected: []sql.Row{
|
||||
{sql.OkResult{RowsAffected: 4, InsertID: 0, Info: plan.UpdateInfo{Matched: 4, Updated: 4}}},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "explain update t set v1 = concat(v1, 'z') where v1 >= 'a'",
|
||||
Expected: []sql.Row{
|
||||
{"Update"},
|
||||
{" └─ UpdateSource(SET t.v1 = concat(t.v1, 'z'))"},
|
||||
{" └─ Filter(t.v1 >= 'a')"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" └─ filters: [{[a, ∞), [NULL, ∞)}]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t",
|
||||
Expected: []sql.Row{
|
||||
{0, "az", "a"},
|
||||
{1, "abz", "ab"},
|
||||
{2, "abcz", "abc"},
|
||||
{3, "abcdez", "abcde"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "delete from t where v1 >= 'a'",
|
||||
Expected: []sql.Row{
|
||||
{sql.OkResult{RowsAffected: 4}},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "explain delete from t where v1 >= 'a'",
|
||||
Expected: []sql.Row{
|
||||
{"Delete"},
|
||||
{" └─ Filter(t.v1 >= 'a')"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" └─ filters: [{[a, ∞), [NULL, ∞)}]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t",
|
||||
Expected: []sql.Row{},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "inline secondary indexes keyless",
|
||||
SetUpScript: []string{
|
||||
"create table t (v1 varchar(10), v2 varchar(10), unique index (v1(3),v2(5)))",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "show create table t",
|
||||
Expected: []sql.Row{{"t", "CREATE TABLE `t` (\n `v1` varchar(10),\n `v2` varchar(10),\n UNIQUE KEY `v1v2` (`v1`(3),`v2`(5))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values ('a', 'a'), ('ab','ab'), ('abc', 'abc'), ('abcde', 'abcde')",
|
||||
Expected: []sql.Row{{sql.NewOkResult(4)}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values ('abc', 'abcde')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "insert into t values ('abc123', 'abcde123')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "select * from t where v1 = 'a'",
|
||||
Expected: []sql.Row{
|
||||
{"a", "a"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "explain select * from t where v1 = 'a'",
|
||||
Expected: []sql.Row{
|
||||
{"Filter(t.v1 = 'a')"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" ├─ filters: [{[a, a], [NULL, ∞)}]"},
|
||||
{" └─ columns: [v1 v2]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t where v1 = 'abc'",
|
||||
Expected: []sql.Row{
|
||||
{"abc", "abc"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "explain select * from t where v1 = 'abc'",
|
||||
Expected: []sql.Row{
|
||||
{"Filter(t.v1 = 'abc')"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" ├─ filters: [{[abc, abc], [NULL, ∞)}]"},
|
||||
{" └─ columns: [v1 v2]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t where v1 = 'abcd'",
|
||||
Expected: []sql.Row{},
|
||||
},
|
||||
{
|
||||
Query: "explain select * from t where v1 = 'abcd'",
|
||||
Expected: []sql.Row{
|
||||
{"Filter(t.v1 = 'abcd')"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" ├─ filters: [{[abcd, abcd], [NULL, ∞)}]"},
|
||||
{" └─ columns: [v1 v2]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t where v1 > 'a' and v1 < 'abcde'",
|
||||
Expected: []sql.Row{
|
||||
{"ab", "ab"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "explain select * from t where v1 > 'a' and v1 < 'abcde'",
|
||||
Expected: []sql.Row{
|
||||
{"Filter((t.v1 > 'a') AND (t.v1 < 'abcde'))"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" ├─ filters: [{(a, abcde), [NULL, ∞)}]"},
|
||||
{" └─ columns: [v1 v2]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t where v1 > 'a' and v2 < 'abcde'",
|
||||
Expected: []sql.Row{
|
||||
{"ab", "ab"},
|
||||
{"abc", "abc"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "explain select * from t where v1 > 'a' and v2 < 'abcde'",
|
||||
Expected: []sql.Row{
|
||||
{"Filter((t.v1 > 'a') AND (t.v2 < 'abcde'))"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" ├─ filters: [{(a, ∞), (NULL, abcde)}]"},
|
||||
{" └─ columns: [v1 v2]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "update t set v1 = concat(v1, 'z') where v1 >= 'a'",
|
||||
Expected: []sql.Row{
|
||||
{sql.OkResult{RowsAffected: 4, InsertID: 0, Info: plan.UpdateInfo{Matched: 4, Updated: 4}}},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "explain update t set v1 = concat(v1, 'z') where v1 >= 'a'",
|
||||
Expected: []sql.Row{
|
||||
{"Update"},
|
||||
{" └─ UpdateSource(SET t.v1 = concat(t.v1, 'z'))"},
|
||||
{" └─ Filter(t.v1 >= 'a')"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" └─ filters: [{[a, ∞), [NULL, ∞)}]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t",
|
||||
Expected: []sql.Row{
|
||||
{"az", "a"},
|
||||
{"abz", "ab"},
|
||||
{"abcz", "abc"},
|
||||
{"abcdez", "abcde"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "delete from t where v1 >= 'a'",
|
||||
Expected: []sql.Row{
|
||||
{sql.OkResult{RowsAffected: 4}},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "explain delete from t where v1 >= 'a'",
|
||||
Expected: []sql.Row{
|
||||
{"Delete"},
|
||||
{" └─ Filter(t.v1 >= 'a')"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" └─ filters: [{[a, ∞), [NULL, ∞)}]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t",
|
||||
Expected: []sql.Row{},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "inline secondary indexes with collation",
|
||||
SetUpScript: []string{
|
||||
@@ -8941,6 +8197,7 @@ var DoltIndexPrefixScripts = []queries.ScriptTest{
|
||||
Query: "select * from t where v1 > 'A' and v1 < 'ABCDE'",
|
||||
Expected: []sql.Row{
|
||||
{1, "ab", "ab"},
|
||||
{2, "abc", "abc"},
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -9018,161 +8275,4 @@ var DoltIndexPrefixScripts = []queries.ScriptTest{
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "referenced secondary indexes",
|
||||
SetUpScript: []string{
|
||||
"create table t (i int primary key, v1 text, v2 text, unique index (v1(3),v2(5)))",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "show create table t",
|
||||
Expected: []sql.Row{{"t", "CREATE TABLE `t` (\n `i` int NOT NULL,\n `v1` text,\n `v2` text,\n PRIMARY KEY (`i`),\n UNIQUE KEY `v1v2` (`v1`(3),`v2`(5))\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values (0, 'a', 'a'), (1, 'ab','ab'), (2, 'abc', 'abc'), (3, 'abcde', 'abcde')",
|
||||
Expected: []sql.Row{{sql.NewOkResult(4)}},
|
||||
},
|
||||
{
|
||||
Query: "insert into t values (99, 'abc', 'abcde')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "insert into t values (99, 'abc123', 'abcde123')",
|
||||
ExpectedErr: sql.ErrUniqueKeyViolation,
|
||||
},
|
||||
{
|
||||
Query: "select * from t where v1 = 'a'",
|
||||
Expected: []sql.Row{
|
||||
{0, "a", "a"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Skip: true,
|
||||
Query: "explain select * from t where v1 = 'a'",
|
||||
Expected: []sql.Row{
|
||||
{"Filter(t.v1 = 'a')"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" ├─ filters: [{[a, a], [NULL, ∞)}]"},
|
||||
{" └─ columns: [i v1 v2]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t where v1 = 'abc'",
|
||||
Expected: []sql.Row{
|
||||
{2, "abc", "abc"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Skip: true,
|
||||
Query: "explain select * from t where v1 = 'abc'",
|
||||
Expected: []sql.Row{
|
||||
{"Filter(t.v1 = 'abc')"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" ├─ filters: [{[abc, abc], [NULL, ∞)}]"},
|
||||
{" └─ columns: [i v1 v2]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t where v1 = 'abcd'",
|
||||
Expected: []sql.Row{},
|
||||
},
|
||||
{
|
||||
Skip: true,
|
||||
Query: "explain select * from t where v1 = 'abcd'",
|
||||
Expected: []sql.Row{
|
||||
{"Filter(t.v1 = 'abcd')"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" ├─ filters: [{[abcd, abcd], [NULL, ∞)}]"},
|
||||
{" └─ columns: [i v1 v2]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t where v1 > 'a' and v1 < 'abcde'",
|
||||
Expected: []sql.Row{
|
||||
{1, "ab", "ab"},
|
||||
{2, "abc", "abc"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Skip: true,
|
||||
Query: "explain select * from t where v1 > 'a' and v1 < 'abcde'",
|
||||
Expected: []sql.Row{
|
||||
{"Filter((t.v1 > 'a') AND (t.v1 < 'abcde'))"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" ├─ filters: [{(a, abcde), [NULL, ∞)}]"},
|
||||
{" └─ columns: [i v1 v2]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t where v1 > 'a' and v2 < 'abcde'",
|
||||
Expected: []sql.Row{
|
||||
{1, "ab", "ab"},
|
||||
{2, "abc", "abc"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Skip: true,
|
||||
Query: "explain select * from t where v1 > 'a' and v2 < 'abcde'",
|
||||
Expected: []sql.Row{
|
||||
{"Filter((t.v1 > 'a') AND (t.v2 < 'abcde'))"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" ├─ filters: [{(a, ∞), (NULL, abcde)}]"},
|
||||
{" └─ columns: [i v1 v2]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "update t set v1 = concat(v1, 'z') where v1 >= 'a'",
|
||||
Expected: []sql.Row{
|
||||
{sql.OkResult{RowsAffected: 4, InsertID: 0, Info: plan.UpdateInfo{Matched: 4, Updated: 4}}},
|
||||
},
|
||||
},
|
||||
{
|
||||
Skip: true,
|
||||
Query: "explain update t set v1 = concat(v1, 'z') where v1 >= 'a'",
|
||||
Expected: []sql.Row{
|
||||
{"Update"},
|
||||
{" └─ UpdateSource(SET t.v1 = concat(t.v1, 'z'))"},
|
||||
{" └─ Filter(t.v1 >= 'a')"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" └─ filters: [{[a, ∞), [NULL, ∞)}]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t",
|
||||
Expected: []sql.Row{
|
||||
{0, "az", "a"},
|
||||
{1, "abz", "ab"},
|
||||
{2, "abcz", "abc"},
|
||||
{3, "abcdez", "abcde"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "delete from t where v1 >= 'a'",
|
||||
Expected: []sql.Row{
|
||||
{sql.OkResult{RowsAffected: 4}},
|
||||
},
|
||||
},
|
||||
{
|
||||
Skip: true,
|
||||
Query: "explain delete from t where v1 >= 'a'",
|
||||
Expected: []sql.Row{
|
||||
{"Delete"},
|
||||
{" └─ Filter(t.v1 >= 'a')"},
|
||||
{" └─ IndexedTableAccess(t)"},
|
||||
{" ├─ index: [t.v1,t.v2]"},
|
||||
{" └─ filters: [{[a, ∞), [NULL, ∞)}]"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Query: "select * from t",
|
||||
Expected: []sql.Row{},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -827,20 +827,20 @@ func (di *doltIndex) prollyRangesFromSqlRanges(ctx context.Context, ns tree.Node
|
||||
fields := make([]prolly.RangeField, len(rng))
|
||||
for j, expr := range rng {
|
||||
if rangeCutIsBinding(expr.LowerBound) {
|
||||
bound := expr.LowerBound.TypeAsLowerBound()
|
||||
fields[j].Lo = prolly.Bound{
|
||||
Binding: true,
|
||||
Inclusive: bound == sql.Closed,
|
||||
}
|
||||
// accumulate bound values in |tb|
|
||||
v, err := getRangeCutValue(expr.LowerBound, rng[j].Typ)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v = di.trimRangeCutValue(j, v)
|
||||
if err = PutField(ctx, ns, tb, j, v); err != nil {
|
||||
nv := di.trimRangeCutValue(j, v)
|
||||
if err = PutField(ctx, ns, tb, j, nv); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
bound := expr.LowerBound.TypeAsLowerBound()
|
||||
fields[j].Lo = prolly.Bound{
|
||||
Binding: true,
|
||||
Inclusive: bound == sql.Closed,
|
||||
}
|
||||
} else {
|
||||
fields[j].Lo = prolly.Bound{}
|
||||
}
|
||||
@@ -854,19 +854,19 @@ func (di *doltIndex) prollyRangesFromSqlRanges(ctx context.Context, ns tree.Node
|
||||
for i, expr := range rng {
|
||||
if rangeCutIsBinding(expr.UpperBound) {
|
||||
bound := expr.UpperBound.TypeAsUpperBound()
|
||||
fields[i].Hi = prolly.Bound{
|
||||
Binding: true,
|
||||
Inclusive: bound == sql.Closed,
|
||||
}
|
||||
// accumulate bound values in |tb|
|
||||
v, err := getRangeCutValue(expr.UpperBound, rng[i].Typ)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v = di.trimRangeCutValue(i, v)
|
||||
if err = PutField(ctx, ns, tb, i, v); err != nil {
|
||||
nv := di.trimRangeCutValue(i, v)
|
||||
if err = PutField(ctx, ns, tb, i, nv); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fields[i].Hi = prolly.Bound{
|
||||
Binding: true,
|
||||
Inclusive: bound == sql.Closed || nv != v, // TODO (james): this might panic for []byte
|
||||
}
|
||||
} else {
|
||||
fields[i].Hi = prolly.Bound{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user