From d1da0e666a6b819d8336b045b9bcae106f871ac1 Mon Sep 17 00:00:00 2001 From: Zach Musgrave Date: Mon, 2 Dec 2024 17:41:46 -0800 Subject: [PATCH 1/8] Change auto increment setup to not specify initial keys --- enginetest/scriptgen/setup/scripts/autoincrement | 8 ++++---- enginetest/scriptgen/setup/setup_data.sg.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/enginetest/scriptgen/setup/scripts/autoincrement b/enginetest/scriptgen/setup/scripts/autoincrement index 91824a0e40..52a2c5eaa9 100644 --- a/enginetest/scriptgen/setup/scripts/autoincrement +++ b/enginetest/scriptgen/setup/scripts/autoincrement @@ -11,8 +11,8 @@ CREATE TABLE `auto_increment_tbl` ( ---- exec -INSERT INTO auto_increment_tbl values - (1, 11), - (2, 22), - (3, 33) +INSERT INTO auto_increment_tbl (c0) values + (11), + (22), + (3) ---- diff --git a/enginetest/scriptgen/setup/setup_data.sg.go b/enginetest/scriptgen/setup/setup_data.sg.go index 15018187c4..1ceb4fd043 100755 --- a/enginetest/scriptgen/setup/setup_data.sg.go +++ b/enginetest/scriptgen/setup/setup_data.sg.go @@ -5,10 +5,10 @@ package setup var AutoincrementData = []SetupScript{{ `drop table if exists auto_increment_tbl`, "CREATE TABLE `auto_increment_tbl` ( `pk` bigint NOT NULL AUTO_INCREMENT, `c0` bigint, PRIMARY KEY (`pk`) )", - `INSERT INTO auto_increment_tbl values - (1, 11), - (2, 22), - (3, 33)`, + `INSERT INTO auto_increment_tbl (c0) values + (11), + (22), + (3)`, }} var BigtableData = []SetupScript{{ From aeb998615e49ccab5e324c2e9654ab5166de5903 Mon Sep 17 00:00:00 2001 From: Zach Musgrave Date: Mon, 2 Dec 2024 17:43:13 -0800 Subject: [PATCH 2/8] Fixed typo --- enginetest/scriptgen/setup/scripts/autoincrement | 2 +- enginetest/scriptgen/setup/setup_data.sg.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/enginetest/scriptgen/setup/scripts/autoincrement b/enginetest/scriptgen/setup/scripts/autoincrement index 52a2c5eaa9..31e916d8af 100644 --- a/enginetest/scriptgen/setup/scripts/autoincrement +++ b/enginetest/scriptgen/setup/scripts/autoincrement @@ -14,5 +14,5 @@ exec INSERT INTO auto_increment_tbl (c0) values (11), (22), - (3) + (33) ---- diff --git a/enginetest/scriptgen/setup/setup_data.sg.go b/enginetest/scriptgen/setup/setup_data.sg.go index 1ceb4fd043..5e115de671 100755 --- a/enginetest/scriptgen/setup/setup_data.sg.go +++ b/enginetest/scriptgen/setup/setup_data.sg.go @@ -8,7 +8,7 @@ var AutoincrementData = []SetupScript{{ `INSERT INTO auto_increment_tbl (c0) values (11), (22), - (3)`, + (33)`, }} var BigtableData = []SetupScript{{ From 3bc2856d05a536e24b8bb254144e6e38ef76a0fd Mon Sep 17 00:00:00 2001 From: Zach Musgrave Date: Tue, 3 Dec 2024 13:05:49 -0800 Subject: [PATCH 3/8] Added docs for existing enginetest types --- enginetest/harness.go | 8 ++++++++ enginetest/queries/queries.go | 24 +++++++++++++++++++++++- enginetest/queries/script_queries.go | 7 +++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/enginetest/harness.go b/enginetest/harness.go index 8b8445e874..3f9eb213de 100644 --- a/enginetest/harness.go +++ b/enginetest/harness.go @@ -171,3 +171,11 @@ type ResultEvaluationHarness interface { // EvaluateExpectedErrorKind compares expected error kinds to actual errors and emits failed test assertions in the EvaluateExpectedErrorKind(t *testing.T, expected *errors.Kind, err error) } + +type DialectHarness interface { + Harness + + // Dialect returns the dialect that the engine being tested supports. If this harness interface isn't implemented, + // the dialect "mysql" is used by engine tests. + Dialect() string +} \ No newline at end of file diff --git a/enginetest/queries/queries.go b/enginetest/queries/queries.go index 32db69e1dc..0a6b0f8d71 100644 --- a/enginetest/queries/queries.go +++ b/enginetest/queries/queries.go @@ -30,12 +30,23 @@ import ( ) type QueryTest struct { + // Query is the query string to execute Query string + // Expected is the expected result of the query Expected []sql.Row - ExpectedColumns sql.Schema // only Name and Type matter here, because that's what we send on the wire + // ExpectedColumns is the set of expected column names for the query results, if specified. + // Only the Name and Type matter of the columns are checked. + ExpectedColumns sql.Schema + // Bindings are the bind values for the query, if provided Bindings map[string]sqlparser.Expr + // SkipPrepared indicates that the query should be skipped when testing prepared statements SkipPrepared bool + // SkipServerEngine indicates that the query should be skipped when testing a server engine (as opposed to the + // simpler in-place engine object) SkipServerEngine bool + // Dialect is the supported dialect for this query, which must match the dialect of the harness if specified. + // The query is skipped if the dialect doesn't match. + Dialect string } type QueryPlanTest struct { @@ -11255,13 +11266,24 @@ var BrokenErrorQueries = []QueryErrorTest{ // WriteQueryTest is a query test for INSERT, UPDATE, etc. statements. It has a query to run and a select query to // validate the results. type WriteQueryTest struct { + // WriteQuery is the INSERT, UPDATE. etc. statement to execute WriteQuery string + // ExpectedWriteResult is the expected result of the write query ExpectedWriteResult []sql.Row + // SelectQuery is a SELECT query to run after successfully executing the WriteQuery SelectQuery string + // ExpectedSelect is the expected result of the SelectQuery ExpectedSelect []sql.Row + // Bindings are the set of values to bind to the query Bindings map[string]sqlparser.Expr + // Skip indicates whether this test should be skipped Skip bool + // SkipServerEngine indicates whether this test should be skipped when the test is being run against a running + // server (as opposed to the simpler Engine-based tests) SkipServerEngine bool + // Dialect is the supported dialect for this test, which must match the dialect of the harness if specified. + // The script is skipped if the dialect doesn't match. + Dialect string } // GenericErrorQueryTest is a query test that is used to assert an error occurs for some query, without specifying what diff --git a/enginetest/queries/script_queries.go b/enginetest/queries/script_queries.go index 2bb5cde6bb..792da4a1c5 100644 --- a/enginetest/queries/script_queries.go +++ b/enginetest/queries/script_queries.go @@ -48,6 +48,9 @@ type ScriptTest struct { JoinTypes []plan.JoinType // SkipPrepared is true when we skip a test for prepared statements only SkipPrepared bool + // Dialect is the supported dialect for this script, which must match the dialect of the harness if specified. + // The script is skipped if the dialect doesn't match. + Dialect string } type ScriptTestAssertion struct { @@ -101,6 +104,10 @@ type ScriptTestAssertion struct { // CheckIndexedAccess indicates whether we should verify the query plan uses an index CheckIndexedAccess bool + + // Dialect is the supported dialect for this assertion, which must match the dialect of the harness if specified. + // The assertion is skipped if the dialect doesn't match. + Dialect string } // ScriptTests are a set of test scripts to run. From 06f0c19a6fd1023cf952c5e95ef324a44dc9f9a2 Mon Sep 17 00:00:00 2001 From: Zach Musgrave Date: Tue, 3 Dec 2024 15:45:53 -0800 Subject: [PATCH 4/8] fixed test setup issues --- enginetest/engine_only_test.go | 2 ++ enginetest/evaluation.go | 43 +++++++++++++++++++++++++++++--- enginetest/join_stats_tests.go | 1 + enginetest/memory_engine_test.go | 5 ++-- enginetest/memory_harness.go | 11 ++++++++ 5 files changed, 56 insertions(+), 6 deletions(-) diff --git a/enginetest/engine_only_test.go b/enginetest/engine_only_test.go index e8515616de..b2e9617b8a 100644 --- a/enginetest/engine_only_test.go +++ b/enginetest/engine_only_test.go @@ -656,6 +656,7 @@ func TestTriggerViewWarning(t *testing.T) { assert.NoError(t, err) ctx := harness.NewContext() + ctx.SetCurrentDatabase("mydb") enginetest.CreateNewConnectionForServerEngine(ctx, e) enginetest.TestQueryWithContext(t, ctx, e, harness, "insert into mytable values (4, 'fourth row')", []sql.Row{{types.NewOkResult(1)}}, nil, nil, nil) @@ -1000,6 +1001,7 @@ func TestAlterTableWithBadSchema(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ctx := harness.NewContext() + ctx.SetCurrentDatabase("mydb") _, iter, _, err := engine.Query(ctx, tt.q) // errors should be analyze time, not execution time if tt.err { diff --git a/enginetest/evaluation.go b/enginetest/evaluation.go index c5b9b64137..1662fe034c 100644 --- a/enginetest/evaluation.go +++ b/enginetest/evaluation.go @@ -87,6 +87,10 @@ func TestScriptWithEngine(t *testing.T, e QueryEngine, harness Harness, script q if sh.SkipQueryTest(script.Name) { t.Skip() } + + if !supportedDialect(harness, script.Dialect) { + t.Skip() + } } for _, statement := range script.SetUpScript { @@ -95,6 +99,7 @@ func TestScriptWithEngine(t *testing.T, e QueryEngine, harness Harness, script q t.Skip() } } + ctx = ctx.WithQuery(statement) RunQueryWithContext(t, e, harness, ctx, statement) } @@ -120,10 +125,7 @@ func TestScriptWithEngine(t *testing.T, e QueryEngine, harness Harness, script q ctx = th.NewSession() } - if sh, ok := harness.(SkippingHarness); ok && sh.SkipQueryTest(assertion.Query) { - t.Skip() - } - if assertion.Skip { + if skipAssertion(t, harness, assertion) { t.Skip() } @@ -158,6 +160,22 @@ func TestScriptWithEngine(t *testing.T, e QueryEngine, harness Harness, script q }) } +func skipAssertion(t *testing.T, harness Harness, assertion queries.ScriptTestAssertion) bool { + if sh, ok := harness.(SkippingHarness); ok && sh.SkipQueryTest(assertion.Query) { + return true + } + + if !supportedDialect(harness, assertion.Dialect) { + return true + } + + if assertion.Skip { + return true + } + + return false +} + // TestScriptPrepared substitutes literals for bindvars, runs the test script given, // and makes any assertions given func TestScriptPrepared(t *testing.T, harness Harness, script queries.ScriptTest) bool { @@ -1113,6 +1131,11 @@ func RunWriteQueryTestWithEngine(t *testing.T, harness Harness, e QueryEngine, t t.Skip() } } + + if !supportedDialect(harness, tt.Dialect) { + t.Skip() + } + ctx := NewContext(harness) TestQueryWithContext(t, ctx, e, harness, tt.WriteQuery, tt.ExpectedWriteResult, nil, nil, nil) expectedSelect := tt.ExpectedSelect @@ -1122,6 +1145,18 @@ func RunWriteQueryTestWithEngine(t *testing.T, harness Harness, e QueryEngine, t TestQueryWithContext(t, ctx, e, harness, tt.SelectQuery, expectedSelect, nil, nil, nil) } +func supportedDialect(harness Harness, dialect string) bool { + if dialect == "" { + return true + } + + harnessDialect := "mysql" + if hd, ok := harness.(DialectHarness); ok { + harnessDialect = hd.Dialect() + } + return harnessDialect == dialect +} + func runWriteQueryTestPrepared(t *testing.T, harness Harness, tt queries.WriteQueryTest) { t.Run(tt.WriteQuery, func(t *testing.T) { if tt.Skip { diff --git a/enginetest/join_stats_tests.go b/enginetest/join_stats_tests.go index b1b2e6b136..7df713e6fd 100644 --- a/enginetest/join_stats_tests.go +++ b/enginetest/join_stats_tests.go @@ -29,6 +29,7 @@ func TestJoinStats(t *testing.T, harness Harness) { e.EngineAnalyzer().Catalog.DbProvider = newPro.(sql.DatabaseProvider) ctx := harness.NewContext() + ctx.SetCurrentDatabase("mydb") for _, q := range tt.setup { _, iter, _, err := e.Query(ctx, q) require.NoError(t, err) diff --git a/enginetest/memory_engine_test.go b/enginetest/memory_engine_test.go index 315c1b243b..5927ca878b 100644 --- a/enginetest/memory_engine_test.go +++ b/enginetest/memory_engine_test.go @@ -120,7 +120,8 @@ func TestJoinOps(t *testing.T) { } func TestJoinStats(t *testing.T) { - harness := enginetest.NewDefaultMemoryHarness() + // We keep join stats in the session, so we need to retain the session after setup + harness := enginetest.NewDefaultMemoryHarness().RetainSessionAfterSetup() if harness.IsUsingServer() { t.Skip("join stats don't work with bindvars") } @@ -450,7 +451,7 @@ func TestTpchQueryPlans(t *testing.T) { for _, indexInit := range indexBehaviors { t.Run(indexInit.name, func(t *testing.T) { - harness := enginetest.NewMemoryHarness(indexInit.name, 1, 1, indexInit.nativeIndexes, indexInit.driverInitializer) + harness := enginetest.NewMemoryHarness(indexInit.name, 1, 1, indexInit.nativeIndexes, indexInit.driverInitializer).RetainSessionAfterSetup() enginetest.TestTpchPlans(t, harness) }) } diff --git a/enginetest/memory_harness.go b/enginetest/memory_harness.go index 952b7054f2..62c8a64e25 100644 --- a/enginetest/memory_harness.go +++ b/enginetest/memory_harness.go @@ -47,6 +47,7 @@ type MemoryHarness struct { skippedQueries map[string]struct{} session sql.Session retainSession bool + retainSessionAfterSetup bool setupData []setup.SetupScript externalProcedureRegistry sql.ExternalStoredProcedureRegistry server bool @@ -98,6 +99,11 @@ func NewReadOnlyMemoryHarness() *MemoryHarness { return h } +func (m MemoryHarness) RetainSessionAfterSetup() *MemoryHarness { + m.retainSessionAfterSetup = true + return &m +} + func (m *MemoryHarness) SessionBuilder() server.SessionBuilder { return func(ctx context.Context, c *mysql.Conn, addr string) (sql.Session, error) { host := "" @@ -191,6 +197,11 @@ func (m *MemoryHarness) NewEngine(t *testing.T) (QueryEngine, error) { return NewServerQueryEngine(t, engine, m.SessionBuilder()) } + // reset the session to clear any session state that may have been set during engine creation + if !m.retainSessionAfterSetup { + m.session = nil + } + return engine, nil } From 20c1d228db90ab24a308478f35880f6fa9d0205a Mon Sep 17 00:00:00 2001 From: Zach Musgrave Date: Tue, 3 Dec 2024 17:15:27 -0800 Subject: [PATCH 5/8] Added mysql dialect to many tests --- enginetest/queries/insert_queries.go | 43 ++++++++++++++++++++++++++++ enginetest/queries/script_queries.go | 16 +++++++++++ 2 files changed, 59 insertions(+) diff --git a/enginetest/queries/insert_queries.go b/enginetest/queries/insert_queries.go index 548afc43e7..8ecb9aab97 100644 --- a/enginetest/queries/insert_queries.go +++ b/enginetest/queries/insert_queries.go @@ -30,24 +30,28 @@ var InsertQueries = []WriteQueryTest{ ExpectedWriteResult: []sql.Row{{types.NewOkResult(1)}}, SelectQuery: "SELECT * FROM keyless WHERE c0 IS NULL;", ExpectedSelect: []sql.Row{{nil, nil}}, + Dialect: "mysql", }, { WriteQuery: "INSERT INTO keyless () VALUES ();", ExpectedWriteResult: []sql.Row{{types.NewOkResult(1)}}, SelectQuery: "SELECT * FROM keyless WHERE c0 IS NULL;", ExpectedSelect: []sql.Row{{nil, nil}}, + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable (s, i) VALUES ('x', '10.0');", ExpectedWriteResult: []sql.Row{{types.NewOkResult(1)}}, SelectQuery: "SELECT i FROM mytable WHERE s = 'x';", ExpectedSelect: []sql.Row{{int64(10)}}, + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable (s, i) VALUES ('x', '64.6');", ExpectedWriteResult: []sql.Row{{types.NewOkResult(1)}}, SelectQuery: "SELECT i FROM mytable WHERE s = 'x';", ExpectedSelect: []sql.Row{{int64(65)}}, + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable (s, i) VALUES ('x', 999);", @@ -66,6 +70,7 @@ var InsertQueries = []WriteQueryTest{ ExpectedWriteResult: []sql.Row{{types.NewOkResult(1)}}, SelectQuery: "SELECT i FROM mytable WHERE s = 'x';", ExpectedSelect: []sql.Row{{int64(999)}}, + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable VALUES (999, 'x');", @@ -78,18 +83,21 @@ var InsertQueries = []WriteQueryTest{ ExpectedWriteResult: []sql.Row{{types.NewOkResult(1)}}, SelectQuery: "SELECT i FROM mytable WHERE s = 'x';", ExpectedSelect: []sql.Row{{int64(999)}}, + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable VALUES (999, _binary 'x');", ExpectedWriteResult: []sql.Row{{types.NewOkResult(1)}}, SelectQuery: "SELECT s FROM mytable WHERE i = 999;", ExpectedSelect: []sql.Row{{"x"}}, + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable SET i = 999, s = _binary 'x';", ExpectedWriteResult: []sql.Row{{types.NewOkResult(1)}}, SelectQuery: "SELECT s FROM mytable WHERE i = 999;", ExpectedSelect: []sql.Row{{"x"}}, + Dialect: "mysql", }, { WriteQuery: `INSERT INTO typestable VALUES ( @@ -475,6 +483,7 @@ var InsertQueries = []WriteQueryTest{ ExpectedWriteResult: []sql.Row{{types.NewOkResult(2)}}, SelectQuery: "SELECT * FROM mytable WHERE i = 1", ExpectedSelect: []sql.Row{{int64(1), "hi"}}, + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable (i,s) values (1, 'hi') AS dt(new_i,new_s) ON DUPLICATE KEY UPDATE s=new_s", @@ -495,18 +504,21 @@ var InsertQueries = []WriteQueryTest{ ExpectedWriteResult: []sql.Row{{types.NewOkResult(2)}}, SelectQuery: "SELECT * FROM mytable WHERE i = 1", ExpectedSelect: []sql.Row{{int64(1), "duplicate"}}, + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable (i,s) values (1,'mar'), (2,'par') ON DUPLICATE KEY UPDATE s=CONCAT(VALUES(s), 'tial')", ExpectedWriteResult: []sql.Row{{types.NewOkResult(4)}}, SelectQuery: "SELECT * FROM mytable WHERE i IN (1,2) ORDER BY i", ExpectedSelect: []sql.Row{{int64(1), "martial"}, {int64(2), "partial"}}, + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable (i,s) values (1,'maybe') ON DUPLICATE KEY UPDATE i=VALUES(i)+8000, s=VALUES(s)", ExpectedWriteResult: []sql.Row{{types.NewOkResult(2)}}, SelectQuery: "SELECT * FROM mytable WHERE i = 8001", ExpectedSelect: []sql.Row{{int64(8001), "maybe"}}, + Dialect: "mysql", }, { WriteQuery: "INSERT INTO auto_increment_tbl (c0) values (44)", @@ -541,6 +553,7 @@ var InsertQueries = []WriteQueryTest{ {3, 33}, {4, 44}, }, + Dialect: "mysql", }, { WriteQuery: "INSERT INTO auto_increment_tbl values (0, 44)", @@ -552,6 +565,7 @@ var InsertQueries = []WriteQueryTest{ {3, 33}, {4, 44}, }, + Dialect: "mysql", }, { WriteQuery: "INSERT INTO auto_increment_tbl values (5, 44)", @@ -579,6 +593,7 @@ var InsertQueries = []WriteQueryTest{ {10, 110}, {11, 121}, }, + Dialect: "mysql", }, { WriteQuery: `INSERT INTO auto_increment_tbl (c0) SELECT 44 FROM dual`, @@ -590,6 +605,7 @@ var InsertQueries = []WriteQueryTest{ {3, 33}, {4, 44}, }, + Dialect: "mysql", }, { WriteQuery: `INSERT INTO othertable VALUES ("fourth", 1) ON DUPLICATE KEY UPDATE s2="fourth"`, @@ -915,6 +931,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "insert into sparse auto_increment table", + Dialect: "mysql", SetUpScript: []string{ "create table auto (pk int primary key auto_increment)", "insert into auto values (10), (20), (30)", @@ -933,6 +950,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "insert negative values into auto_increment values", + Dialect: "mysql", SetUpScript: []string{ "create table auto (pk int primary key auto_increment)", "insert into auto values (10), (20), (30)", @@ -981,6 +999,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "insert into auto_increment key/index column", + Dialect: "mysql", SetUpScript: []string{ "create table auto_no_primary (i int auto_increment, index(i))", "insert into auto_no_primary (i) values (0), (0), (0)", @@ -996,6 +1015,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "insert into auto_increment with multiple key/index columns", + Dialect: "mysql", SetUpScript: []string{ "create table auto_no_primary (i int auto_increment, j int, index(i))", "insert into auto_no_primary (i) values (0), (0), (0)", @@ -1011,6 +1031,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "auto increment table handles deletes", + Dialect: "mysql", SetUpScript: []string{ "create table auto (pk int primary key auto_increment)", "insert into auto values (10)", @@ -1028,6 +1049,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "create auto_increment table with out-of-line primary key def", + Dialect: "mysql", SetUpScript: []string{ `create table auto ( pk int auto_increment, @@ -1047,6 +1069,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "alter auto_increment value", + Dialect: "mysql", SetUpScript: []string{ `create table auto ( pk int auto_increment, @@ -1078,6 +1101,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "alter auto_increment value to float", + Dialect: "mysql", SetUpScript: []string{ `create table auto ( pk int auto_increment, @@ -1099,6 +1123,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "auto increment on tinyint", + Dialect: "mysql", SetUpScript: []string{ "create table auto (pk tinyint primary key auto_increment)", "insert into auto values (NULL),(10),(0)", @@ -1114,6 +1139,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "auto increment on smallint", + Dialect: "mysql", SetUpScript: []string{ "create table auto (pk smallint primary key auto_increment)", "insert into auto values (NULL),(10),(0)", @@ -1129,6 +1155,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "auto increment on mediumint", + Dialect: "mysql", SetUpScript: []string{ "create table auto (pk mediumint primary key auto_increment)", "insert into auto values (NULL),(10),(0)", @@ -1144,6 +1171,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "auto increment on int", + Dialect: "mysql", SetUpScript: []string{ "create table auto (pk int primary key auto_increment)", "insert into auto values (NULL),(10),(0)", @@ -1159,6 +1187,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "auto increment on bigint", + Dialect: "mysql", SetUpScript: []string{ "create table auto (pk bigint primary key auto_increment)", "insert into auto values (NULL),(10),(0)", @@ -1174,6 +1203,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "auto increment on tinyint unsigned", + Dialect: "mysql", SetUpScript: []string{ "create table auto (pk tinyint unsigned primary key auto_increment)", "insert into auto values (NULL),(10),(0)", @@ -1189,6 +1219,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "auto increment on smallint unsigned", + Dialect: "mysql", SetUpScript: []string{ "create table auto (pk smallint unsigned primary key auto_increment)", "insert into auto values (NULL),(10),(0)", @@ -1204,6 +1235,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "auto increment on mediumint unsigned", + Dialect: "mysql", SetUpScript: []string{ "create table auto (pk mediumint unsigned primary key auto_increment)", "insert into auto values (NULL),(10),(0)", @@ -1219,6 +1251,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "auto increment on int unsigned", + Dialect: "mysql", SetUpScript: []string{ "create table auto (pk int unsigned primary key auto_increment)", "insert into auto values (NULL),(10),(0)", @@ -1234,6 +1267,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "auto increment on bigint unsigned", + Dialect: "mysql", SetUpScript: []string{ "create table auto (pk bigint unsigned primary key auto_increment)", "insert into auto values (NULL),(10),(0)", @@ -1249,6 +1283,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "auto increment on float", + Dialect: "mysql", SetUpScript: []string{ "create table auto (pk float primary key auto_increment)", "insert into auto values (NULL),(10),(0)", @@ -1264,6 +1299,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "auto increment on double", + Dialect: "mysql", SetUpScript: []string{ "create table auto (pk double primary key auto_increment)", "insert into auto values (NULL),(10),(0)", @@ -1279,6 +1315,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "sql_mode=NO_auto_value_ON_ZERO", + Dialect: "mysql", SetUpScript: []string{ "set @old_sql_mode=@@sql_mode;", "set @@sql_mode='NO_auto_value_ON_ZERO';", @@ -1362,6 +1399,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "explicit DEFAULT", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE t1(id int DEFAULT '2', dt datetime DEFAULT now());", "CREATE TABLE t2(id varchar(100) DEFAULT (uuid()));", @@ -1459,6 +1497,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "Explicit default with column reference", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE t1 (a int default 1, b int default (a+1));", }, @@ -1956,6 +1995,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "INSERT INTO ... SELECT works properly with ENUM", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE test (pk BIGINT PRIMARY KEY NOT NULL, v1 ENUM('a','b','c'));", }, @@ -1972,6 +2012,7 @@ var InsertScripts = []ScriptTest{ }, { Name: "INSERT INTO ... SELECT works properly with SET", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE test (pk BIGINT PRIMARY KEY NOT NULL, v1 SET('a','b','c'));", }, @@ -2025,6 +2066,7 @@ var InsertScripts = []ScriptTest{ { // https://github.com/dolthub/dolt/issues/5411 Name: "Defaults with escaped strings", + Dialect: "mysql", SetUpScript: []string{ `CREATE TABLE escpe ( id int NOT NULL AUTO_INCREMENT, @@ -2073,6 +2115,7 @@ var InsertScripts = []ScriptTest{ { // https://github.com/dolthub/dolt/issues/5411 Name: "check constrains with escaped strings", + Dialect: "mysql", SetUpScript: []string{ `CREATE TABLE quoted ( id int NOT NULL AUTO_INCREMENT, val varchar(15) NOT NULL CHECK (val IN ('joe''s', diff --git a/enginetest/queries/script_queries.go b/enginetest/queries/script_queries.go index 792da4a1c5..672731bb7f 100644 --- a/enginetest/queries/script_queries.go +++ b/enginetest/queries/script_queries.go @@ -129,6 +129,7 @@ var ScriptTests = []ScriptTest{ }, { Name: "alter nil enum", + Dialect: "mysql", SetUpScript: []string{ "create table xy (x int primary key, y enum ('a', 'b'));", "insert into xy values (0, NULL),(1, 'b')", @@ -1040,6 +1041,7 @@ CREATE TABLE tab3 ( }, { Name: "alter table out of range value error of column type change", + Dialect: "mysql", SetUpScript: []string{ "create table t (i int primary key, i2 int, key(i2));", "insert into t values (0,-1)", @@ -1053,6 +1055,7 @@ CREATE TABLE tab3 ( }, { Name: "alter keyless table", + Dialect: "mysql", SetUpScript: []string{ "create table t (c1 int, c2 varchar(200), c3 enum('one', 'two'));", "insert into t values (1, 'one', NULL);", @@ -1138,6 +1141,7 @@ CREATE TABLE tab3 ( }, { Name: "enums with default, case-sensitive collation (utf8mb4_0900_bin)", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE enumtest1 (pk int primary key, e enum('abc', 'XYZ'));", "CREATE TABLE enumtest2 (pk int PRIMARY KEY, e enum('x ', 'X ', 'y', 'Y'));", @@ -1193,6 +1197,7 @@ CREATE TABLE tab3 ( }, { Name: "enums with case-insensitive collation (utf8mb4_0900_ai_ci)", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE enumtest1 (pk int primary key, e enum('abc', 'XYZ') collate utf8mb4_0900_ai_ci);", }, @@ -1275,10 +1280,12 @@ CREATE TABLE tab3 ( }, { Query: "REPLACE INTO test VALUES (1,7), (4,8), (5,9);", + Dialect: "mysql", ExpectedErr: sql.ErrForeignKeyParentViolation, }, { Query: "SELECT * FROM test;", + Dialect: "mysql", Expected: []sql.Row{{1, 1}, {4, 4}, {5, 5}}, }, { @@ -1563,6 +1570,7 @@ CREATE TABLE tab3 ( }, { Name: "UUIDs used in the wild.", + Dialect: "mysql", SetUpScript: []string{ "SET @uuid = '6ccd780c-baba-1026-9564-5b8c656024db'", "SET @binuuid = '0011223344556677'", @@ -1616,6 +1624,7 @@ CREATE TABLE tab3 ( }, { Name: "Test cases on select into statement", + Dialect: "mysql", SetUpScript: []string{ "SELECT * FROM (VALUES ROW(22,44,88)) AS t INTO @x,@y,@z", "CREATE TABLE tab1 (id int primary key, v1 int)", @@ -1724,6 +1733,7 @@ CREATE TABLE tab3 ( }, { Name: "last_insert_uuid() behavior", + Dialect: "mysql", SetUpScript: []string{ "create table varchar36 (pk varchar(36) primary key default (UUID()), i int);", "create table char36 (pk char(36) primary key default (UUID()), i int);", @@ -1996,6 +2006,7 @@ CREATE TABLE tab3 ( }, { Name: "last_insert_id() behavior", + Dialect: "mysql", SetUpScript: []string{ "create table a (x int primary key auto_increment, y int)", "create table b (x int primary key)", @@ -2067,6 +2078,7 @@ CREATE TABLE tab3 ( }, { Name: "last_insert_id(expr) behavior", + Dialect: "mysql", SetUpScript: []string{ "create table a (x int primary key auto_increment, y int)", }, @@ -2103,6 +2115,7 @@ CREATE TABLE tab3 ( }, { Name: "last_insert_id(default) behavior", + Dialect: "mysql", SetUpScript: []string{ "create table t (pk int primary key auto_increment, i int default 0)", }, @@ -2318,6 +2331,7 @@ CREATE TABLE tab3 ( }, { Name: "row_count() behavior", + Dialect: "mysql", SetUpScript: []string{ "create table b (x int primary key)", "insert into b values (1), (2), (3), (4)", @@ -2618,6 +2632,7 @@ CREATE TABLE tab3 ( }, { Name: "Group Concat Queries", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE x (pk int)", "INSERT INTO x VALUES (1),(2),(3),(4),(NULL)", @@ -2706,6 +2721,7 @@ CREATE TABLE tab3 ( }, { Name: "CONVERT USING still converts between incompatible character sets", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE test (pk BIGINT PRIMARY KEY, v1 VARCHAR(200)) COLLATE=utf8mb4_0900_ai_ci;", "INSERT INTO test VALUES (1, '63273াম'), (2, 'GHD30r'), (3, '8জ্রিয277'), (4, NULL);", From 1c2dfd2640fe8d7f1ab05010acf21c631b14cb93 Mon Sep 17 00:00:00 2001 From: Zach Musgrave Date: Wed, 4 Dec 2024 16:21:09 -0800 Subject: [PATCH 6/8] mysql dialect work --- enginetest/queries/script_queries.go | 44 ++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/enginetest/queries/script_queries.go b/enginetest/queries/script_queries.go index 672731bb7f..5e17d82cc4 100644 --- a/enginetest/queries/script_queries.go +++ b/enginetest/queries/script_queries.go @@ -2442,6 +2442,7 @@ CREATE TABLE tab3 ( }, { Name: "found_rows() behavior", + Dialect: "mysql", SetUpScript: []string{ "create table b (x int primary key)", "insert into b values (1), (2), (3), (4)", @@ -2734,7 +2735,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "ALTER TABLE, ALTER COLUMN SET , DROP DEFAULT", + Name: "ALTER TABLE, ALTER COLUMN SET, DROP DEFAULT", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE test (pk BIGINT PRIMARY KEY, v1 BIGINT NOT NULL DEFAULT 88);", }, @@ -2990,6 +2992,7 @@ CREATE TABLE tab3 ( }, { Name: "unix_timestamp function usage", + Dialect: "mysql", SetUpScript: []string{ // NOTE: session time zone needs to be set as UNIX_TIMESTAMP function depends on it and converts the final result "SET @@SESSION.time_zone = 'UTC';", @@ -3014,6 +3017,7 @@ CREATE TABLE tab3 ( }, { Name: "unix_timestamp with non UTC timezone", + Dialect: "mysql", SetUpScript: []string{ "SET @@SESSION.time_zone = 'UTC';", "CREATE TABLE `datetime_table` ( `i` bigint NOT NULL, `datetime_col` datetime, `timestamp_col` timestamp, PRIMARY KEY (`i`) )", @@ -3031,6 +3035,7 @@ CREATE TABLE tab3 ( }, { Name: "Issue #499", // https://github.com/dolthub/go-mysql-server/issues/499 + Dialect: "mysql", SetUpScript: []string{ "SET @@SESSION.time_zone = 'UTC';", "CREATE TABLE test (time TIMESTAMP, value DOUBLE);", @@ -3065,6 +3070,7 @@ CREATE TABLE tab3 ( }, { Name: "WHERE clause considers ENUM/SET types for comparisons", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE test (pk BIGINT PRIMARY KEY, v1 ENUM('a', 'b', 'c'), v2 SET('a', 'b', 'c'));", "INSERT INTO test VALUES (1, 2, 2), (2, 1, 1);", @@ -3109,6 +3115,7 @@ CREATE TABLE tab3 ( }, { Name: "Simple Update Join test that manipulates two tables", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE test (pk int primary key);", `CREATE TABLE test2 (pk int primary key, val int);`, @@ -3238,6 +3245,7 @@ CREATE TABLE tab3 ( }, { Name: "Ensure scale is not rounded when inserting to DECIMAL type through float64", + Dialect: "mysql", SetUpScript: []string{ "create table test (number decimal(40,16));", "insert into test values ('11981.5923291839784651');", @@ -3471,6 +3479,7 @@ CREATE TABLE tab3 ( }, { Name: "Multialter DDL with ADD/DROP Primary Key", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE t(pk int primary key, v1 int)", }, @@ -3503,6 +3512,7 @@ CREATE TABLE tab3 ( }, { Name: "Multialter DDL with ADD/DROP INDEX", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE t(pk int primary key, v1 int)", }, @@ -3623,6 +3633,7 @@ CREATE TABLE tab3 ( }, { Query: "show create table test", + Dialect: "mysql", Expected: []sql.Row{ {"test", "CREATE TABLE `test` (\n `i` int DEFAULT '999',\n `j` json DEFAULT ('[]')\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}, }, @@ -3631,6 +3642,7 @@ CREATE TABLE tab3 ( }, { Name: "ALTER TABLE MULTI ADD/DROP COLUMN", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE test (pk BIGINT PRIMARY KEY, v1 BIGINT NOT NULL DEFAULT 88);", }, @@ -3727,6 +3739,7 @@ CREATE TABLE tab3 ( }, { Name: "describe and show columns with various keys and constraints", + Dialect: "mysql", SetUpScript: []string{ "create table t1 (i int not null, unique key (i));", "create table t2 (i int not null, j int not null, unique key (j), unique key(i));", @@ -3820,6 +3833,7 @@ CREATE TABLE tab3 ( }, { Name: "ALTER TABLE MODIFY column with multiple UNIQUE KEYS", + Dialect: "mysql", SetUpScript: []string{ "CREATE table test (pk int primary key, uk1 int, uk2 int, unique(uk1, uk2))", "ALTER TABLE `test` MODIFY column uk1 int auto_increment", @@ -3837,6 +3851,7 @@ CREATE TABLE tab3 ( }, { Name: "ALTER TABLE MODIFY column with multiple KEYS", + Dialect: "mysql", SetUpScript: []string{ "CREATE table test (pk int primary key, mk1 int, mk2 int, index(mk1, mk2))", "ALTER TABLE `test` MODIFY column mk1 int auto_increment", @@ -3873,6 +3888,7 @@ CREATE TABLE tab3 ( }, { Name: "failed conversion shows warning", + Dialect: "mysql", Assertions: []ScriptTestAssertion{ { Query: "SELECT CONVERT('10000-12-31 23:59:59', DATETIME)", @@ -3913,6 +3929,7 @@ CREATE TABLE tab3 ( }, { Name: "Describe with expressions and views work correctly", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE t(pk int primary key, val int DEFAULT (pk * 2))", }, @@ -3928,6 +3945,7 @@ CREATE TABLE tab3 ( }, { Name: "Check support for deprecated BINARY attribute after character set", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE test (pk BIGINT PRIMARY KEY, v1 VARCHAR(255) COLLATE utf8mb4_0900_bin);", }, @@ -4015,6 +4033,7 @@ CREATE TABLE tab3 ( }, { Name: "basic test on tables dual and `dual`", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE `dual` (id int)", "INSERT INTO `dual` VALUES (2)", @@ -4029,6 +4048,7 @@ CREATE TABLE tab3 ( Expected: []sql.Row{{3}}, }, { + Dialect: "mysql", Query: "SELECT * from dual;", ExpectedErr: sql.ErrNoTablesUsed, }, @@ -4135,7 +4155,7 @@ CREATE TABLE tab3 ( }, Assertions: []ScriptTestAssertion{ { - Query: "create view t as select 1 from dual", + Query: "create view t as select 1", ExpectedErr: sql.ErrTableAlreadyExists, }, }, @@ -4143,7 +4163,7 @@ CREATE TABLE tab3 ( { Name: "can't create table with same name as existing view", SetUpScript: []string{ - "create view t as select 1 from dual", + "create view t as select 1", }, Assertions: []ScriptTestAssertion{ { @@ -4190,6 +4210,7 @@ CREATE TABLE tab3 ( {1.9230769936149668}, {2.083333250549108}, {2.272727223467237}}, }, { + Dialect: "mysql", Query: `select f/'a' from floats;`, Expected: []sql.Row{{nil}, {nil}, {nil}}, }, @@ -4197,6 +4218,7 @@ CREATE TABLE tab3 ( }, { Name: "'%' mod operation result in decimal or float", + Dialect: "mysql", // % operator between types not defined in other dialects SetUpScript: []string{ "create table a (pk int primary key, c1 int, c2 double, c3 decimal(5,3));", "insert into a values (1, 1, 1.111, 1.111), (2, 2, 2.111, 2.111);", @@ -4254,6 +4276,7 @@ CREATE TABLE tab3 ( }, { Name: "year type behavior", + Dialect: "mysql", SetUpScript: []string{ "create table t (pk int primary key, col1 year);", }, @@ -4338,6 +4361,7 @@ CREATE TABLE tab3 ( }, { Name: "INSERT IGNORE correctly truncates column data", + Dialect: "mysql", SetUpScript: []string{ `CREATE TABLE t ( pk int primary key, @@ -4424,6 +4448,7 @@ CREATE TABLE tab3 ( }, { Name: "hash lookup for joins works with binary", + Dialect: "mysql", SetUpScript: []string{ "create table uv (u int primary key, v int);", "create table xy (x int primary key, y int);", @@ -4443,6 +4468,7 @@ CREATE TABLE tab3 ( }, { Name: "enum columns work as expected in when clauses", + Dialect: "mysql", SetUpScript: []string{ "create table enums (e enum('a'));", "insert into enums values ('a');", @@ -4460,6 +4486,7 @@ CREATE TABLE tab3 ( }, { Name: "SET and ENUM properly handle integers using UPDATE and DELETE statements", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE setenumtest (pk INT PRIMARY KEY, v1 ENUM('a', 'b', 'c'), v2 SET('a', 'b', 'c'));", }, @@ -4592,6 +4619,7 @@ CREATE TABLE tab3 ( }, { Name: "drop table if exists on unknown table shows warning", + Dialect: "mysql", Assertions: []ScriptTestAssertion{ { Query: "DROP TABLE IF EXISTS non_existent_table;", @@ -4604,6 +4632,7 @@ CREATE TABLE tab3 ( }, { Name: "find_in_set tests", + Dialect: "mysql", SetUpScript: []string{ "create table set_tbl (i int primary key, s set('a','b','c'));", "insert into set_tbl values (0, '');", @@ -4668,6 +4697,7 @@ CREATE TABLE tab3 ( }, { Name: "coalesce tests", + Dialect: "mysql", SetUpScript: []string{ "create table c select coalesce(NULL, 1);", }, @@ -4704,6 +4734,7 @@ CREATE TABLE tab3 ( }, { Name: "renaming views with RENAME TABLE ... TO .. statement", + Dialect: "mysql", SetUpScript: []string{ "create table t1 (id int primary key, v1 int);", "create view v1 as select * from t1;", @@ -4733,6 +4764,7 @@ CREATE TABLE tab3 ( }, { Name: "renaming views with ALTER TABLE ... RENAME .. statement should fail", + Dialect: "mysql", SetUpScript: []string{ "create table t1 (id int primary key, v1 int);", "create view v1 as select * from t1;", @@ -4754,6 +4786,7 @@ CREATE TABLE tab3 ( }, { Name: "timezone default settings", + Dialect: "mysql", Assertions: []ScriptTestAssertion{ { // TODO: Skipping this test while we figure out why this change causes the mysql java @@ -4773,6 +4806,7 @@ CREATE TABLE tab3 ( }, { Name: "current time functions", + Dialect: "mysql", Assertions: []ScriptTestAssertion{ { // Smoke test that NOW() and UTC_TIMESTAMP() return non-null values with the SYSTEM time zone @@ -4818,6 +4852,7 @@ CREATE TABLE tab3 ( }, { Name: "timestamp timezone conversion", + Dialect: "mysql", SetUpScript: []string{ "set time_zone='+00:00';", "create table timezonetest(pk int primary key, dt datetime, ts timestamp);", @@ -4922,6 +4957,7 @@ CREATE TABLE tab3 ( }, { Name: "case insensitive index handling", + Dialect: "mysql", SetUpScript: []string{ "create table table_One (Id int primary key, Val1 int);", "create table TableTwo (iD int primary key, VAL2 int, vAL3 int);", @@ -5019,6 +5055,7 @@ CREATE TABLE tab3 ( }, }, { + Dialect: "mysql", Name: "UNIX_TIMESTAMP function usage with session different time zones", Assertions: []ScriptTestAssertion{ { @@ -5053,6 +5090,7 @@ CREATE TABLE tab3 ( }, { Name: "Querying existing view that references non-existing table", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE a(id int primary key, col1 int);", "CREATE VIEW b AS SELECT * FROM a;", From c61589e4288a7d97fa2ec3a97c5e148af0002192 Mon Sep 17 00:00:00 2001 From: Zach Musgrave Date: Thu, 5 Dec 2024 14:24:07 -0800 Subject: [PATCH 7/8] More mysql dialect exceptions --- enginetest/queries/script_queries.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/enginetest/queries/script_queries.go b/enginetest/queries/script_queries.go index 5e17d82cc4..967ba69852 100644 --- a/enginetest/queries/script_queries.go +++ b/enginetest/queries/script_queries.go @@ -5090,7 +5090,6 @@ CREATE TABLE tab3 ( }, { Name: "Querying existing view that references non-existing table", - Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE a(id int primary key, col1 int);", "CREATE VIEW b AS SELECT * FROM a;", @@ -5354,7 +5353,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "Complex Filter Index Scan", + Name: "Complex Filter Index Scan #2", SetUpScript: []string{ "create table t (pk int primary key, v1 int, v2 int, v3 int, v4 int);", "create index v_idx on t (v1, v2, v3, v4);", @@ -5370,7 +5369,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "Complex Filter Index Scan", + Name: "Complex Filter Index Scan #3", SetUpScript: []string{ "create table t (pk integer primary key, col0 integer, col1 float);", "create index idx on t (col0, col1);", @@ -5984,6 +5983,7 @@ CREATE TABLE tab3 ( }, { Name: "floats in tuple are properly hashed", + Dialect: "mysql", SetUpScript: []string{ "create table t (b bool);", "insert into t values (false);", @@ -6020,6 +6020,7 @@ CREATE TABLE tab3 ( }, { Name: "strings in tuple are properly hashed", + Dialect: "mysql", SetUpScript: []string{ "create table t (v varchar(100));", "insert into t values (false);", @@ -6111,6 +6112,7 @@ CREATE TABLE tab3 ( }, { Name: "resolve foreign key on indexed update", + Dialect: "mysql", // no way to disable foreign keys in doltgres yet SetUpScript: []string{ "set foreign_key_checks=0;", "create table parent (i int primary key);", @@ -6128,6 +6130,7 @@ CREATE TABLE tab3 ( }, { Name: "between type conversion", + Dialect: "mysql", SetUpScript: []string{ "create table t0(c0 bool);", "create table t1(c1 bool);", @@ -6182,6 +6185,7 @@ CREATE TABLE tab3 ( }, { Name: "bool and string", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE t0(c0 BOOL, PRIMARY KEY(c0));", "INSERT INTO t0 (c0) VALUES (true);", @@ -6212,6 +6216,7 @@ CREATE TABLE tab3 ( }, { Name: "bool and int", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE t0(c0 INTEGER, PRIMARY KEY(c0));", "INSERT INTO t0 (c0) VALUES (true);", @@ -6315,6 +6320,7 @@ CREATE TABLE tab3 ( }, { Name: "range query convert int to string zero value", + Dialect: "mysql", SetUpScript: []string{ `CREATE TABLE t0(c0 VARCHAR(500));`, `INSERT INTO t0(c0) VALUES ('a');`, @@ -6951,7 +6957,6 @@ where {"12345", "1234567890"}, }, }, - { Query: "insert into t2 (a, b) values ('1234567890', '12345')", ExpectedErrStr: "string '1234567890' is too large for column 'a'", @@ -7015,6 +7020,7 @@ where }, { Name: "test show create database", + Dialect: "mysql", SetUpScript: []string{ "create database def_db;", "create database latin1_db character set latin1;", @@ -7050,6 +7056,7 @@ where }, { Name: "test create database with modified server variables", + Dialect: "mysql", SetUpScript: []string{ "set @@session.character_set_server = 'latin1';", "create database latin1_db;", @@ -7078,6 +7085,7 @@ where }, { Name: "test index naming", + Dialect: "mysql", SetUpScript: []string{ "create table t (i int);", "alter table t add index (i);", @@ -7120,6 +7128,7 @@ where }, { Name: "test parenthesized tables", + Dialect: "mysql", SetUpScript: []string{ "create table t1 (i int);", "insert into t1 values (1), (2), (3);", @@ -7222,6 +7231,7 @@ where }, { Name: "unix_timestamp script tests", + Dialect: "mysql", SetUpScript: []string{ "set time_zone = 'UTC';", "create table t1 (i int primary key, v varchar(100));", @@ -7252,6 +7262,7 @@ where }, { Name: "name_const queries", + Dialect: "mysql", SetUpScript: []string{ "create table t (i int primary key);", "insert into t values (1), (2), (3);", From 6a1e0aac3c95dfa67588052c84a222267352429e Mon Sep 17 00:00:00 2001 From: zachmu Date: Thu, 5 Dec 2024 22:29:38 +0000 Subject: [PATCH 8/8] [ga-format-pr] Run ./format_repo.sh to fix formatting --- enginetest/evaluation.go | 14 +-- enginetest/harness.go | 6 +- enginetest/queries/insert_queries.go | 80 +++++++-------- enginetest/queries/queries.go | 28 +++--- enginetest/queries/script_queries.go | 142 +++++++++++++-------------- 5 files changed, 135 insertions(+), 135 deletions(-) diff --git a/enginetest/evaluation.go b/enginetest/evaluation.go index 1662fe034c..c4ae3f4971 100644 --- a/enginetest/evaluation.go +++ b/enginetest/evaluation.go @@ -88,7 +88,7 @@ func TestScriptWithEngine(t *testing.T, e QueryEngine, harness Harness, script q t.Skip() } - if !supportedDialect(harness, script.Dialect) { + if !supportedDialect(harness, script.Dialect) { t.Skip() } } @@ -99,7 +99,7 @@ func TestScriptWithEngine(t *testing.T, e QueryEngine, harness Harness, script q t.Skip() } } - + ctx = ctx.WithQuery(statement) RunQueryWithContext(t, e, harness, ctx, statement) } @@ -172,7 +172,7 @@ func skipAssertion(t *testing.T, harness Harness, assertion queries.ScriptTestAs if assertion.Skip { return true } - + return false } @@ -1131,11 +1131,11 @@ func RunWriteQueryTestWithEngine(t *testing.T, harness Harness, e QueryEngine, t t.Skip() } } - - if !supportedDialect(harness, tt.Dialect) { + + if !supportedDialect(harness, tt.Dialect) { t.Skip() } - + ctx := NewContext(harness) TestQueryWithContext(t, ctx, e, harness, tt.WriteQuery, tt.ExpectedWriteResult, nil, nil, nil) expectedSelect := tt.ExpectedSelect @@ -1149,7 +1149,7 @@ func supportedDialect(harness Harness, dialect string) bool { if dialect == "" { return true } - + harnessDialect := "mysql" if hd, ok := harness.(DialectHarness); ok { harnessDialect = hd.Dialect() diff --git a/enginetest/harness.go b/enginetest/harness.go index 3f9eb213de..b4e5f5656d 100644 --- a/enginetest/harness.go +++ b/enginetest/harness.go @@ -174,8 +174,8 @@ type ResultEvaluationHarness interface { type DialectHarness interface { Harness - - // Dialect returns the dialect that the engine being tested supports. If this harness interface isn't implemented, + + // Dialect returns the dialect that the engine being tested supports. If this harness interface isn't implemented, // the dialect "mysql" is used by engine tests. Dialect() string -} \ No newline at end of file +} diff --git a/enginetest/queries/insert_queries.go b/enginetest/queries/insert_queries.go index 8ecb9aab97..cade4821b2 100644 --- a/enginetest/queries/insert_queries.go +++ b/enginetest/queries/insert_queries.go @@ -30,28 +30,28 @@ var InsertQueries = []WriteQueryTest{ ExpectedWriteResult: []sql.Row{{types.NewOkResult(1)}}, SelectQuery: "SELECT * FROM keyless WHERE c0 IS NULL;", ExpectedSelect: []sql.Row{{nil, nil}}, - Dialect: "mysql", + Dialect: "mysql", }, { WriteQuery: "INSERT INTO keyless () VALUES ();", ExpectedWriteResult: []sql.Row{{types.NewOkResult(1)}}, SelectQuery: "SELECT * FROM keyless WHERE c0 IS NULL;", ExpectedSelect: []sql.Row{{nil, nil}}, - Dialect: "mysql", + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable (s, i) VALUES ('x', '10.0');", ExpectedWriteResult: []sql.Row{{types.NewOkResult(1)}}, SelectQuery: "SELECT i FROM mytable WHERE s = 'x';", ExpectedSelect: []sql.Row{{int64(10)}}, - Dialect: "mysql", + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable (s, i) VALUES ('x', '64.6');", ExpectedWriteResult: []sql.Row{{types.NewOkResult(1)}}, SelectQuery: "SELECT i FROM mytable WHERE s = 'x';", ExpectedSelect: []sql.Row{{int64(65)}}, - Dialect: "mysql", + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable (s, i) VALUES ('x', 999);", @@ -70,7 +70,7 @@ var InsertQueries = []WriteQueryTest{ ExpectedWriteResult: []sql.Row{{types.NewOkResult(1)}}, SelectQuery: "SELECT i FROM mytable WHERE s = 'x';", ExpectedSelect: []sql.Row{{int64(999)}}, - Dialect: "mysql", + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable VALUES (999, 'x');", @@ -83,21 +83,21 @@ var InsertQueries = []WriteQueryTest{ ExpectedWriteResult: []sql.Row{{types.NewOkResult(1)}}, SelectQuery: "SELECT i FROM mytable WHERE s = 'x';", ExpectedSelect: []sql.Row{{int64(999)}}, - Dialect: "mysql", + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable VALUES (999, _binary 'x');", ExpectedWriteResult: []sql.Row{{types.NewOkResult(1)}}, SelectQuery: "SELECT s FROM mytable WHERE i = 999;", ExpectedSelect: []sql.Row{{"x"}}, - Dialect: "mysql", + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable SET i = 999, s = _binary 'x';", ExpectedWriteResult: []sql.Row{{types.NewOkResult(1)}}, SelectQuery: "SELECT s FROM mytable WHERE i = 999;", ExpectedSelect: []sql.Row{{"x"}}, - Dialect: "mysql", + Dialect: "mysql", }, { WriteQuery: `INSERT INTO typestable VALUES ( @@ -483,7 +483,7 @@ var InsertQueries = []WriteQueryTest{ ExpectedWriteResult: []sql.Row{{types.NewOkResult(2)}}, SelectQuery: "SELECT * FROM mytable WHERE i = 1", ExpectedSelect: []sql.Row{{int64(1), "hi"}}, - Dialect: "mysql", + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable (i,s) values (1, 'hi') AS dt(new_i,new_s) ON DUPLICATE KEY UPDATE s=new_s", @@ -504,21 +504,21 @@ var InsertQueries = []WriteQueryTest{ ExpectedWriteResult: []sql.Row{{types.NewOkResult(2)}}, SelectQuery: "SELECT * FROM mytable WHERE i = 1", ExpectedSelect: []sql.Row{{int64(1), "duplicate"}}, - Dialect: "mysql", + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable (i,s) values (1,'mar'), (2,'par') ON DUPLICATE KEY UPDATE s=CONCAT(VALUES(s), 'tial')", ExpectedWriteResult: []sql.Row{{types.NewOkResult(4)}}, SelectQuery: "SELECT * FROM mytable WHERE i IN (1,2) ORDER BY i", ExpectedSelect: []sql.Row{{int64(1), "martial"}, {int64(2), "partial"}}, - Dialect: "mysql", + Dialect: "mysql", }, { WriteQuery: "INSERT INTO mytable (i,s) values (1,'maybe') ON DUPLICATE KEY UPDATE i=VALUES(i)+8000, s=VALUES(s)", ExpectedWriteResult: []sql.Row{{types.NewOkResult(2)}}, SelectQuery: "SELECT * FROM mytable WHERE i = 8001", ExpectedSelect: []sql.Row{{int64(8001), "maybe"}}, - Dialect: "mysql", + Dialect: "mysql", }, { WriteQuery: "INSERT INTO auto_increment_tbl (c0) values (44)", @@ -930,7 +930,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "insert into sparse auto_increment table", + Name: "insert into sparse auto_increment table", Dialect: "mysql", SetUpScript: []string{ "create table auto (pk int primary key auto_increment)", @@ -949,7 +949,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "insert negative values into auto_increment values", + Name: "insert negative values into auto_increment values", Dialect: "mysql", SetUpScript: []string{ "create table auto (pk int primary key auto_increment)", @@ -998,7 +998,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "insert into auto_increment key/index column", + Name: "insert into auto_increment key/index column", Dialect: "mysql", SetUpScript: []string{ "create table auto_no_primary (i int auto_increment, index(i))", @@ -1014,7 +1014,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "insert into auto_increment with multiple key/index columns", + Name: "insert into auto_increment with multiple key/index columns", Dialect: "mysql", SetUpScript: []string{ "create table auto_no_primary (i int auto_increment, j int, index(i))", @@ -1030,7 +1030,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "auto increment table handles deletes", + Name: "auto increment table handles deletes", Dialect: "mysql", SetUpScript: []string{ "create table auto (pk int primary key auto_increment)", @@ -1048,7 +1048,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "create auto_increment table with out-of-line primary key def", + Name: "create auto_increment table with out-of-line primary key def", Dialect: "mysql", SetUpScript: []string{ `create table auto ( @@ -1068,7 +1068,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "alter auto_increment value", + Name: "alter auto_increment value", Dialect: "mysql", SetUpScript: []string{ `create table auto ( @@ -1100,7 +1100,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "alter auto_increment value to float", + Name: "alter auto_increment value to float", Dialect: "mysql", SetUpScript: []string{ `create table auto ( @@ -1122,7 +1122,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "auto increment on tinyint", + Name: "auto increment on tinyint", Dialect: "mysql", SetUpScript: []string{ "create table auto (pk tinyint primary key auto_increment)", @@ -1138,7 +1138,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "auto increment on smallint", + Name: "auto increment on smallint", Dialect: "mysql", SetUpScript: []string{ "create table auto (pk smallint primary key auto_increment)", @@ -1154,7 +1154,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "auto increment on mediumint", + Name: "auto increment on mediumint", Dialect: "mysql", SetUpScript: []string{ "create table auto (pk mediumint primary key auto_increment)", @@ -1170,7 +1170,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "auto increment on int", + Name: "auto increment on int", Dialect: "mysql", SetUpScript: []string{ "create table auto (pk int primary key auto_increment)", @@ -1186,7 +1186,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "auto increment on bigint", + Name: "auto increment on bigint", Dialect: "mysql", SetUpScript: []string{ "create table auto (pk bigint primary key auto_increment)", @@ -1202,7 +1202,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "auto increment on tinyint unsigned", + Name: "auto increment on tinyint unsigned", Dialect: "mysql", SetUpScript: []string{ "create table auto (pk tinyint unsigned primary key auto_increment)", @@ -1218,7 +1218,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "auto increment on smallint unsigned", + Name: "auto increment on smallint unsigned", Dialect: "mysql", SetUpScript: []string{ "create table auto (pk smallint unsigned primary key auto_increment)", @@ -1234,7 +1234,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "auto increment on mediumint unsigned", + Name: "auto increment on mediumint unsigned", Dialect: "mysql", SetUpScript: []string{ "create table auto (pk mediumint unsigned primary key auto_increment)", @@ -1250,7 +1250,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "auto increment on int unsigned", + Name: "auto increment on int unsigned", Dialect: "mysql", SetUpScript: []string{ "create table auto (pk int unsigned primary key auto_increment)", @@ -1266,7 +1266,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "auto increment on bigint unsigned", + Name: "auto increment on bigint unsigned", Dialect: "mysql", SetUpScript: []string{ "create table auto (pk bigint unsigned primary key auto_increment)", @@ -1282,7 +1282,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "auto increment on float", + Name: "auto increment on float", Dialect: "mysql", SetUpScript: []string{ "create table auto (pk float primary key auto_increment)", @@ -1298,7 +1298,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "auto increment on double", + Name: "auto increment on double", Dialect: "mysql", SetUpScript: []string{ "create table auto (pk double primary key auto_increment)", @@ -1314,7 +1314,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "sql_mode=NO_auto_value_ON_ZERO", + Name: "sql_mode=NO_auto_value_ON_ZERO", Dialect: "mysql", SetUpScript: []string{ "set @old_sql_mode=@@sql_mode;", @@ -1398,7 +1398,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "explicit DEFAULT", + Name: "explicit DEFAULT", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE t1(id int DEFAULT '2', dt datetime DEFAULT now());", @@ -1496,7 +1496,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "Explicit default with column reference", + Name: "Explicit default with column reference", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE t1 (a int default 1, b int default (a+1));", @@ -1994,8 +1994,8 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "INSERT INTO ... SELECT works properly with ENUM", - Dialect: "mysql", + Name: "INSERT INTO ... SELECT works properly with ENUM", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE test (pk BIGINT PRIMARY KEY NOT NULL, v1 ENUM('a','b','c'));", }, @@ -2011,7 +2011,7 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "INSERT INTO ... SELECT works properly with SET", + Name: "INSERT INTO ... SELECT works properly with SET", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE test (pk BIGINT PRIMARY KEY NOT NULL, v1 SET('a','b','c'));", @@ -2065,7 +2065,7 @@ var InsertScripts = []ScriptTest{ }, { // https://github.com/dolthub/dolt/issues/5411 - Name: "Defaults with escaped strings", + Name: "Defaults with escaped strings", Dialect: "mysql", SetUpScript: []string{ `CREATE TABLE escpe ( @@ -2114,7 +2114,7 @@ var InsertScripts = []ScriptTest{ }, { // https://github.com/dolthub/dolt/issues/5411 - Name: "check constrains with escaped strings", + Name: "check constrains with escaped strings", Dialect: "mysql", SetUpScript: []string{ `CREATE TABLE quoted ( id int NOT NULL AUTO_INCREMENT, diff --git a/enginetest/queries/queries.go b/enginetest/queries/queries.go index 0a6b0f8d71..cbc8d2df91 100644 --- a/enginetest/queries/queries.go +++ b/enginetest/queries/queries.go @@ -31,17 +31,17 @@ import ( type QueryTest struct { // Query is the query string to execute - Query string + Query string // Expected is the expected result of the query - Expected []sql.Row + Expected []sql.Row // ExpectedColumns is the set of expected column names for the query results, if specified. // Only the Name and Type matter of the columns are checked. - ExpectedColumns sql.Schema + ExpectedColumns sql.Schema // Bindings are the bind values for the query, if provided - Bindings map[string]sqlparser.Expr + Bindings map[string]sqlparser.Expr // SkipPrepared indicates that the query should be skipped when testing prepared statements - SkipPrepared bool - // SkipServerEngine indicates that the query should be skipped when testing a server engine (as opposed to the + SkipPrepared bool + // SkipServerEngine indicates that the query should be skipped when testing a server engine (as opposed to the // simpler in-place engine object) SkipServerEngine bool // Dialect is the supported dialect for this query, which must match the dialect of the harness if specified. @@ -11267,20 +11267,20 @@ var BrokenErrorQueries = []QueryErrorTest{ // validate the results. type WriteQueryTest struct { // WriteQuery is the INSERT, UPDATE. etc. statement to execute - WriteQuery string + WriteQuery string // ExpectedWriteResult is the expected result of the write query ExpectedWriteResult []sql.Row // SelectQuery is a SELECT query to run after successfully executing the WriteQuery - SelectQuery string + SelectQuery string // ExpectedSelect is the expected result of the SelectQuery - ExpectedSelect []sql.Row + ExpectedSelect []sql.Row // Bindings are the set of values to bind to the query - Bindings map[string]sqlparser.Expr + Bindings map[string]sqlparser.Expr // Skip indicates whether this test should be skipped - Skip bool - // SkipServerEngine indicates whether this test should be skipped when the test is being run against a running - // server (as opposed to the simpler Engine-based tests) - SkipServerEngine bool + Skip bool + // SkipServerEngine indicates whether this test should be skipped when the test is being run against a running + // server (as opposed to the simpler Engine-based tests) + SkipServerEngine bool // Dialect is the supported dialect for this test, which must match the dialect of the harness if specified. // The script is skipped if the dialect doesn't match. Dialect string diff --git a/enginetest/queries/script_queries.go b/enginetest/queries/script_queries.go index 967ba69852..fd71665b0f 100644 --- a/enginetest/queries/script_queries.go +++ b/enginetest/queries/script_queries.go @@ -104,7 +104,7 @@ type ScriptTestAssertion struct { // CheckIndexedAccess indicates whether we should verify the query plan uses an index CheckIndexedAccess bool - + // Dialect is the supported dialect for this assertion, which must match the dialect of the harness if specified. // The assertion is skipped if the dialect doesn't match. Dialect string @@ -128,7 +128,7 @@ var ScriptTests = []ScriptTest{ }, }, { - Name: "alter nil enum", + Name: "alter nil enum", Dialect: "mysql", SetUpScript: []string{ "create table xy (x int primary key, y enum ('a', 'b'));", @@ -1040,7 +1040,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "alter table out of range value error of column type change", + Name: "alter table out of range value error of column type change", Dialect: "mysql", SetUpScript: []string{ "create table t (i int primary key, i2 int, key(i2));", @@ -1054,7 +1054,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "alter keyless table", + Name: "alter keyless table", Dialect: "mysql", SetUpScript: []string{ "create table t (c1 int, c2 varchar(200), c3 enum('one', 'two'));", @@ -1140,7 +1140,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "enums with default, case-sensitive collation (utf8mb4_0900_bin)", + Name: "enums with default, case-sensitive collation (utf8mb4_0900_bin)", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE enumtest1 (pk int primary key, e enum('abc', 'XYZ'));", @@ -1196,7 +1196,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "enums with case-insensitive collation (utf8mb4_0900_ai_ci)", + Name: "enums with case-insensitive collation (utf8mb4_0900_ai_ci)", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE enumtest1 (pk int primary key, e enum('abc', 'XYZ') collate utf8mb4_0900_ai_ci);", @@ -1280,12 +1280,12 @@ CREATE TABLE tab3 ( }, { Query: "REPLACE INTO test VALUES (1,7), (4,8), (5,9);", - Dialect: "mysql", + Dialect: "mysql", ExpectedErr: sql.ErrForeignKeyParentViolation, }, { Query: "SELECT * FROM test;", - Dialect: "mysql", + Dialect: "mysql", Expected: []sql.Row{{1, 1}, {4, 4}, {5, 5}}, }, { @@ -1569,7 +1569,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "UUIDs used in the wild.", + Name: "UUIDs used in the wild.", Dialect: "mysql", SetUpScript: []string{ "SET @uuid = '6ccd780c-baba-1026-9564-5b8c656024db'", @@ -1623,7 +1623,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "Test cases on select into statement", + Name: "Test cases on select into statement", Dialect: "mysql", SetUpScript: []string{ "SELECT * FROM (VALUES ROW(22,44,88)) AS t INTO @x,@y,@z", @@ -1732,7 +1732,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "last_insert_uuid() behavior", + Name: "last_insert_uuid() behavior", Dialect: "mysql", SetUpScript: []string{ "create table varchar36 (pk varchar(36) primary key default (UUID()), i int);", @@ -2005,7 +2005,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "last_insert_id() behavior", + Name: "last_insert_id() behavior", Dialect: "mysql", SetUpScript: []string{ "create table a (x int primary key auto_increment, y int)", @@ -2077,7 +2077,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "last_insert_id(expr) behavior", + Name: "last_insert_id(expr) behavior", Dialect: "mysql", SetUpScript: []string{ "create table a (x int primary key auto_increment, y int)", @@ -2114,7 +2114,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "last_insert_id(default) behavior", + Name: "last_insert_id(default) behavior", Dialect: "mysql", SetUpScript: []string{ "create table t (pk int primary key auto_increment, i int default 0)", @@ -2330,7 +2330,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "row_count() behavior", + Name: "row_count() behavior", Dialect: "mysql", SetUpScript: []string{ "create table b (x int primary key)", @@ -2441,7 +2441,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "found_rows() behavior", + Name: "found_rows() behavior", Dialect: "mysql", SetUpScript: []string{ "create table b (x int primary key)", @@ -2632,7 +2632,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "Group Concat Queries", + Name: "Group Concat Queries", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE x (pk int)", @@ -2721,7 +2721,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "CONVERT USING still converts between incompatible character sets", + Name: "CONVERT USING still converts between incompatible character sets", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE test (pk BIGINT PRIMARY KEY, v1 VARCHAR(200)) COLLATE=utf8mb4_0900_ai_ci;", @@ -2735,7 +2735,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "ALTER TABLE, ALTER COLUMN SET, DROP DEFAULT", + Name: "ALTER TABLE, ALTER COLUMN SET, DROP DEFAULT", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE test (pk BIGINT PRIMARY KEY, v1 BIGINT NOT NULL DEFAULT 88);", @@ -2991,7 +2991,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "unix_timestamp function usage", + Name: "unix_timestamp function usage", Dialect: "mysql", SetUpScript: []string{ // NOTE: session time zone needs to be set as UNIX_TIMESTAMP function depends on it and converts the final result @@ -3016,7 +3016,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "unix_timestamp with non UTC timezone", + Name: "unix_timestamp with non UTC timezone", Dialect: "mysql", SetUpScript: []string{ "SET @@SESSION.time_zone = 'UTC';", @@ -3034,7 +3034,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "Issue #499", // https://github.com/dolthub/go-mysql-server/issues/499 + Name: "Issue #499", // https://github.com/dolthub/go-mysql-server/issues/499 Dialect: "mysql", SetUpScript: []string{ "SET @@SESSION.time_zone = 'UTC';", @@ -3069,7 +3069,7 @@ CREATE TABLE tab3 ( SkipPrepared: true, }, { - Name: "WHERE clause considers ENUM/SET types for comparisons", + Name: "WHERE clause considers ENUM/SET types for comparisons", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE test (pk BIGINT PRIMARY KEY, v1 ENUM('a', 'b', 'c'), v2 SET('a', 'b', 'c'));", @@ -3114,7 +3114,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "Simple Update Join test that manipulates two tables", + Name: "Simple Update Join test that manipulates two tables", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE test (pk int primary key);", @@ -3244,7 +3244,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "Ensure scale is not rounded when inserting to DECIMAL type through float64", + Name: "Ensure scale is not rounded when inserting to DECIMAL type through float64", Dialect: "mysql", SetUpScript: []string{ "create table test (number decimal(40,16));", @@ -3478,7 +3478,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "Multialter DDL with ADD/DROP Primary Key", + Name: "Multialter DDL with ADD/DROP Primary Key", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE t(pk int primary key, v1 int)", @@ -3511,7 +3511,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "Multialter DDL with ADD/DROP INDEX", + Name: "Multialter DDL with ADD/DROP INDEX", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE t(pk int primary key, v1 int)", @@ -3632,7 +3632,7 @@ CREATE TABLE tab3 ( Expected: []sql.Row{{types.NewOkResult(0)}}, }, { - Query: "show create table test", + Query: "show create table test", Dialect: "mysql", Expected: []sql.Row{ {"test", "CREATE TABLE `test` (\n `i` int DEFAULT '999',\n `j` json DEFAULT ('[]')\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}, @@ -3641,7 +3641,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "ALTER TABLE MULTI ADD/DROP COLUMN", + Name: "ALTER TABLE MULTI ADD/DROP COLUMN", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE test (pk BIGINT PRIMARY KEY, v1 BIGINT NOT NULL DEFAULT 88);", @@ -3738,7 +3738,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "describe and show columns with various keys and constraints", + Name: "describe and show columns with various keys and constraints", Dialect: "mysql", SetUpScript: []string{ "create table t1 (i int not null, unique key (i));", @@ -3832,7 +3832,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "ALTER TABLE MODIFY column with multiple UNIQUE KEYS", + Name: "ALTER TABLE MODIFY column with multiple UNIQUE KEYS", Dialect: "mysql", SetUpScript: []string{ "CREATE table test (pk int primary key, uk1 int, uk2 int, unique(uk1, uk2))", @@ -3850,7 +3850,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "ALTER TABLE MODIFY column with multiple KEYS", + Name: "ALTER TABLE MODIFY column with multiple KEYS", Dialect: "mysql", SetUpScript: []string{ "CREATE table test (pk int primary key, mk1 int, mk2 int, index(mk1, mk2))", @@ -3887,7 +3887,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "failed conversion shows warning", + Name: "failed conversion shows warning", Dialect: "mysql", Assertions: []ScriptTestAssertion{ { @@ -3928,7 +3928,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "Describe with expressions and views work correctly", + Name: "Describe with expressions and views work correctly", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE t(pk int primary key, val int DEFAULT (pk * 2))", @@ -3944,7 +3944,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "Check support for deprecated BINARY attribute after character set", + Name: "Check support for deprecated BINARY attribute after character set", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE test (pk BIGINT PRIMARY KEY, v1 VARCHAR(255) COLLATE utf8mb4_0900_bin);", @@ -4032,7 +4032,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "basic test on tables dual and `dual`", + Name: "basic test on tables dual and `dual`", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE `dual` (id int)", @@ -4048,7 +4048,7 @@ CREATE TABLE tab3 ( Expected: []sql.Row{{3}}, }, { - Dialect: "mysql", + Dialect: "mysql", Query: "SELECT * from dual;", ExpectedErr: sql.ErrNoTablesUsed, }, @@ -4210,14 +4210,14 @@ CREATE TABLE tab3 ( {1.9230769936149668}, {2.083333250549108}, {2.272727223467237}}, }, { - Dialect: "mysql", + Dialect: "mysql", Query: `select f/'a' from floats;`, Expected: []sql.Row{{nil}, {nil}, {nil}}, }, }, }, { - Name: "'%' mod operation result in decimal or float", + Name: "'%' mod operation result in decimal or float", Dialect: "mysql", // % operator between types not defined in other dialects SetUpScript: []string{ "create table a (pk int primary key, c1 int, c2 double, c3 decimal(5,3));", @@ -4275,8 +4275,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "year type behavior", - Dialect: "mysql", + Name: "year type behavior", + Dialect: "mysql", SetUpScript: []string{ "create table t (pk int primary key, col1 year);", }, @@ -4360,8 +4360,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "INSERT IGNORE correctly truncates column data", - Dialect: "mysql", + Name: "INSERT IGNORE correctly truncates column data", + Dialect: "mysql", SetUpScript: []string{ `CREATE TABLE t ( pk int primary key, @@ -4447,8 +4447,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "hash lookup for joins works with binary", - Dialect: "mysql", + Name: "hash lookup for joins works with binary", + Dialect: "mysql", SetUpScript: []string{ "create table uv (u int primary key, v int);", "create table xy (x int primary key, y int);", @@ -4467,7 +4467,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "enum columns work as expected in when clauses", + Name: "enum columns work as expected in when clauses", Dialect: "mysql", SetUpScript: []string{ "create table enums (e enum('a'));", @@ -4485,7 +4485,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "SET and ENUM properly handle integers using UPDATE and DELETE statements", + Name: "SET and ENUM properly handle integers using UPDATE and DELETE statements", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE setenumtest (pk INT PRIMARY KEY, v1 ENUM('a', 'b', 'c'), v2 SET('a', 'b', 'c'));", @@ -4618,7 +4618,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "drop table if exists on unknown table shows warning", + Name: "drop table if exists on unknown table shows warning", Dialect: "mysql", Assertions: []ScriptTestAssertion{ { @@ -4631,7 +4631,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "find_in_set tests", + Name: "find_in_set tests", Dialect: "mysql", SetUpScript: []string{ "create table set_tbl (i int primary key, s set('a','b','c'));", @@ -4696,7 +4696,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "coalesce tests", + Name: "coalesce tests", Dialect: "mysql", SetUpScript: []string{ "create table c select coalesce(NULL, 1);", @@ -4733,7 +4733,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "renaming views with RENAME TABLE ... TO .. statement", + Name: "renaming views with RENAME TABLE ... TO .. statement", Dialect: "mysql", SetUpScript: []string{ "create table t1 (id int primary key, v1 int);", @@ -4763,7 +4763,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "renaming views with ALTER TABLE ... RENAME .. statement should fail", + Name: "renaming views with ALTER TABLE ... RENAME .. statement should fail", Dialect: "mysql", SetUpScript: []string{ "create table t1 (id int primary key, v1 int);", @@ -4785,7 +4785,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "timezone default settings", + Name: "timezone default settings", Dialect: "mysql", Assertions: []ScriptTestAssertion{ { @@ -4805,7 +4805,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "current time functions", + Name: "current time functions", Dialect: "mysql", Assertions: []ScriptTestAssertion{ { @@ -4851,7 +4851,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "timestamp timezone conversion", + Name: "timestamp timezone conversion", Dialect: "mysql", SetUpScript: []string{ "set time_zone='+00:00';", @@ -4956,7 +4956,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "case insensitive index handling", + Name: "case insensitive index handling", Dialect: "mysql", SetUpScript: []string{ "create table table_One (Id int primary key, Val1 int);", @@ -5055,8 +5055,8 @@ CREATE TABLE tab3 ( }, }, { - Dialect: "mysql", - Name: "UNIX_TIMESTAMP function usage with session different time zones", + Dialect: "mysql", + Name: "UNIX_TIMESTAMP function usage with session different time zones", Assertions: []ScriptTestAssertion{ { Query: "SET time_zone = '+07:00';", @@ -5982,7 +5982,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "floats in tuple are properly hashed", + Name: "floats in tuple are properly hashed", Dialect: "mysql", SetUpScript: []string{ "create table t (b bool);", @@ -6019,7 +6019,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "strings in tuple are properly hashed", + Name: "strings in tuple are properly hashed", Dialect: "mysql", SetUpScript: []string{ "create table t (v varchar(100));", @@ -6111,7 +6111,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "resolve foreign key on indexed update", + Name: "resolve foreign key on indexed update", Dialect: "mysql", // no way to disable foreign keys in doltgres yet SetUpScript: []string{ "set foreign_key_checks=0;", @@ -6129,7 +6129,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "between type conversion", + Name: "between type conversion", Dialect: "mysql", SetUpScript: []string{ "create table t0(c0 bool);", @@ -6184,7 +6184,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "bool and string", + Name: "bool and string", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE t0(c0 BOOL, PRIMARY KEY(c0));", @@ -6215,7 +6215,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "bool and int", + Name: "bool and int", Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE t0(c0 INTEGER, PRIMARY KEY(c0));", @@ -6319,7 +6319,7 @@ CREATE TABLE tab3 ( }, }, { - Name: "range query convert int to string zero value", + Name: "range query convert int to string zero value", Dialect: "mysql", SetUpScript: []string{ `CREATE TABLE t0(c0 VARCHAR(500));`, @@ -7019,7 +7019,7 @@ where }, }, { - Name: "test show create database", + Name: "test show create database", Dialect: "mysql", SetUpScript: []string{ "create database def_db;", @@ -7055,7 +7055,7 @@ where }, }, { - Name: "test create database with modified server variables", + Name: "test create database with modified server variables", Dialect: "mysql", SetUpScript: []string{ "set @@session.character_set_server = 'latin1';", @@ -7084,7 +7084,7 @@ where }, }, { - Name: "test index naming", + Name: "test index naming", Dialect: "mysql", SetUpScript: []string{ "create table t (i int);", @@ -7127,7 +7127,7 @@ where }, }, { - Name: "test parenthesized tables", + Name: "test parenthesized tables", Dialect: "mysql", SetUpScript: []string{ "create table t1 (i int);", @@ -7230,7 +7230,7 @@ where }, }, { - Name: "unix_timestamp script tests", + Name: "unix_timestamp script tests", Dialect: "mysql", SetUpScript: []string{ "set time_zone = 'UTC';", @@ -7261,7 +7261,7 @@ where }, }, { - Name: "name_const queries", + Name: "name_const queries", Dialect: "mysql", SetUpScript: []string{ "create table t (i int primary key);",