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..c4ae3f4971 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/harness.go b/enginetest/harness.go index 8b8445e874..b4e5f5656d 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 +} 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 } diff --git a/enginetest/queries/insert_queries.go b/enginetest/queries/insert_queries.go index 548afc43e7..cade4821b2 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"`, @@ -914,7 +930,8 @@ 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)", "insert into auto values (10), (20), (30)", @@ -932,7 +949,8 @@ 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)", "insert into auto values (10), (20), (30)", @@ -980,7 +998,8 @@ 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))", "insert into auto_no_primary (i) values (0), (0), (0)", @@ -995,7 +1014,8 @@ 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))", "insert into auto_no_primary (i) values (0), (0), (0)", @@ -1010,7 +1030,8 @@ 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)", "insert into auto values (10)", @@ -1027,7 +1048,8 @@ 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 ( pk int auto_increment, @@ -1046,7 +1068,8 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "alter auto_increment value", + Name: "alter auto_increment value", + Dialect: "mysql", SetUpScript: []string{ `create table auto ( pk int auto_increment, @@ -1077,7 +1100,8 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "alter auto_increment value to float", + Name: "alter auto_increment value to float", + Dialect: "mysql", SetUpScript: []string{ `create table auto ( pk int auto_increment, @@ -1098,7 +1122,8 @@ 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)", "insert into auto values (NULL),(10),(0)", @@ -1113,7 +1138,8 @@ 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)", "insert into auto values (NULL),(10),(0)", @@ -1128,7 +1154,8 @@ 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)", "insert into auto values (NULL),(10),(0)", @@ -1143,7 +1170,8 @@ 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)", "insert into auto values (NULL),(10),(0)", @@ -1158,7 +1186,8 @@ 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)", "insert into auto values (NULL),(10),(0)", @@ -1173,7 +1202,8 @@ 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)", "insert into auto values (NULL),(10),(0)", @@ -1188,7 +1218,8 @@ 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)", "insert into auto values (NULL),(10),(0)", @@ -1203,7 +1234,8 @@ 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)", "insert into auto values (NULL),(10),(0)", @@ -1218,7 +1250,8 @@ 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)", "insert into auto values (NULL),(10),(0)", @@ -1233,7 +1266,8 @@ 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)", "insert into auto values (NULL),(10),(0)", @@ -1248,7 +1282,8 @@ 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)", "insert into auto values (NULL),(10),(0)", @@ -1263,7 +1298,8 @@ 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)", "insert into auto values (NULL),(10),(0)", @@ -1278,7 +1314,8 @@ 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;", "set @@sql_mode='NO_auto_value_ON_ZERO';", @@ -1361,7 +1398,8 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "explicit DEFAULT", + 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()));", @@ -1458,7 +1496,8 @@ 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));", }, @@ -1955,7 +1994,8 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "INSERT INTO ... SELECT works properly with ENUM", + 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'));", }, @@ -1971,7 +2011,8 @@ 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'));", }, @@ -2024,7 +2065,8 @@ 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 ( id int NOT NULL AUTO_INCREMENT, @@ -2072,7 +2114,8 @@ 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, val varchar(15) NOT NULL CHECK (val IN ('joe''s', diff --git a/enginetest/queries/queries.go b/enginetest/queries/queries.go index 32db69e1dc..cbc8d2df91 100644 --- a/enginetest/queries/queries.go +++ b/enginetest/queries/queries.go @@ -30,12 +30,23 @@ import ( ) type QueryTest struct { - Query string - Expected []sql.Row - ExpectedColumns sql.Schema // only Name and Type matter here, because that's what we send on the wire - Bindings map[string]sqlparser.Expr - SkipPrepared bool + // Query is the query string to execute + Query string + // Expected is the expected result of the query + 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 + // 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 string + // WriteQuery is the INSERT, UPDATE. etc. statement to execute + WriteQuery string + // ExpectedWriteResult is the expected result of the write query ExpectedWriteResult []sql.Row - SelectQuery string - ExpectedSelect []sql.Row - Bindings map[string]sqlparser.Expr - Skip bool - SkipServerEngine bool + // 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..fd71665b0f 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. @@ -121,7 +128,8 @@ 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'));", "insert into xy values (0, NULL),(1, 'b')", @@ -1032,7 +1040,8 @@ 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));", "insert into t values (0,-1)", @@ -1045,7 +1054,8 @@ 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'));", "insert into t values (1, 'one', NULL);", @@ -1130,7 +1140,8 @@ 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'));", "CREATE TABLE enumtest2 (pk int PRIMARY KEY, e enum('x ', 'X ', 'y', 'Y'));", @@ -1185,7 +1196,8 @@ 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);", }, @@ -1268,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}}, }, { @@ -1555,7 +1569,8 @@ 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'", "SET @binuuid = '0011223344556677'", @@ -1608,7 +1623,8 @@ 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", "CREATE TABLE tab1 (id int primary key, v1 int)", @@ -1716,7 +1732,8 @@ 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);", "create table char36 (pk char(36) primary key default (UUID()), i int);", @@ -1988,7 +2005,8 @@ 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)", "create table b (x int primary key)", @@ -2059,7 +2077,8 @@ 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)", }, @@ -2095,7 +2114,8 @@ 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)", }, @@ -2310,7 +2330,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "row_count() behavior", + Name: "row_count() behavior", + Dialect: "mysql", SetUpScript: []string{ "create table b (x int primary key)", "insert into b values (1), (2), (3), (4)", @@ -2420,7 +2441,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "found_rows() behavior", + Name: "found_rows() behavior", + Dialect: "mysql", SetUpScript: []string{ "create table b (x int primary key)", "insert into b values (1), (2), (3), (4)", @@ -2610,7 +2632,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "Group Concat Queries", + Name: "Group Concat Queries", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE x (pk int)", "INSERT INTO x VALUES (1),(2),(3),(4),(NULL)", @@ -2698,7 +2721,8 @@ 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;", "INSERT INTO test VALUES (1, '63273াম'), (2, 'GHD30r'), (3, '8জ্রিয277'), (4, NULL);", @@ -2711,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);", }, @@ -2966,7 +2991,8 @@ 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 "SET @@SESSION.time_zone = 'UTC';", @@ -2990,7 +3016,8 @@ 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';", "CREATE TABLE `datetime_table` ( `i` bigint NOT NULL, `datetime_col` datetime, `timestamp_col` timestamp, PRIMARY KEY (`i`) )", @@ -3007,7 +3034,8 @@ 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';", "CREATE TABLE test (time TIMESTAMP, value DOUBLE);", @@ -3041,7 +3069,8 @@ 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'));", "INSERT INTO test VALUES (1, 2, 2), (2, 1, 1);", @@ -3085,7 +3114,8 @@ 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);", `CREATE TABLE test2 (pk int primary key, val int);`, @@ -3214,7 +3244,8 @@ 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));", "insert into test values ('11981.5923291839784651');", @@ -3447,7 +3478,8 @@ 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)", }, @@ -3479,7 +3511,8 @@ 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)", }, @@ -3599,7 +3632,8 @@ 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"}, }, @@ -3607,7 +3641,8 @@ 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);", }, @@ -3703,7 +3738,8 @@ 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));", "create table t2 (i int not null, j int not null, unique key (j), unique key(i));", @@ -3796,7 +3832,8 @@ 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))", "ALTER TABLE `test` MODIFY column uk1 int auto_increment", @@ -3813,7 +3850,8 @@ 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))", "ALTER TABLE `test` MODIFY column mk1 int auto_increment", @@ -3849,7 +3887,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "failed conversion shows warning", + Name: "failed conversion shows warning", + Dialect: "mysql", Assertions: []ScriptTestAssertion{ { Query: "SELECT CONVERT('10000-12-31 23:59:59', DATETIME)", @@ -3889,7 +3928,8 @@ 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))", }, @@ -3904,7 +3944,8 @@ 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);", }, @@ -3991,7 +4032,8 @@ 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)", "INSERT INTO `dual` VALUES (2)", @@ -4006,6 +4048,7 @@ CREATE TABLE tab3 ( Expected: []sql.Row{{3}}, }, { + Dialect: "mysql", Query: "SELECT * from dual;", ExpectedErr: sql.ErrNoTablesUsed, }, @@ -4112,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, }, }, @@ -4120,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{ { @@ -4167,13 +4210,15 @@ CREATE TABLE tab3 ( {1.9230769936149668}, {2.083333250549108}, {2.272727223467237}}, }, { + 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));", "insert into a values (1, 1, 1.111, 1.111), (2, 2, 2.111, 2.111);", @@ -4230,7 +4275,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "year type behavior", + Name: "year type behavior", + Dialect: "mysql", SetUpScript: []string{ "create table t (pk int primary key, col1 year);", }, @@ -4314,7 +4360,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "INSERT IGNORE correctly truncates column data", + Name: "INSERT IGNORE correctly truncates column data", + Dialect: "mysql", SetUpScript: []string{ `CREATE TABLE t ( pk int primary key, @@ -4400,7 +4447,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "hash lookup for joins works with binary", + 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);", @@ -4419,7 +4467,8 @@ 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'));", "insert into enums values ('a');", @@ -4436,7 +4485,8 @@ 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'));", }, @@ -4568,7 +4618,8 @@ 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{ { Query: "DROP TABLE IF EXISTS non_existent_table;", @@ -4580,7 +4631,8 @@ 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'));", "insert into set_tbl values (0, '');", @@ -4644,7 +4696,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "coalesce tests", + Name: "coalesce tests", + Dialect: "mysql", SetUpScript: []string{ "create table c select coalesce(NULL, 1);", }, @@ -4680,7 +4733,8 @@ 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);", "create view v1 as select * from t1;", @@ -4709,7 +4763,8 @@ 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);", "create view v1 as select * from t1;", @@ -4730,7 +4785,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "timezone default settings", + Name: "timezone default settings", + Dialect: "mysql", Assertions: []ScriptTestAssertion{ { // TODO: Skipping this test while we figure out why this change causes the mysql java @@ -4749,7 +4805,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "current time functions", + Name: "current time functions", + Dialect: "mysql", Assertions: []ScriptTestAssertion{ { // Smoke test that NOW() and UTC_TIMESTAMP() return non-null values with the SYSTEM time zone @@ -4794,7 +4851,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "timestamp timezone conversion", + Name: "timestamp timezone conversion", + Dialect: "mysql", SetUpScript: []string{ "set time_zone='+00:00';", "create table timezonetest(pk int primary key, dt datetime, ts timestamp);", @@ -4898,7 +4956,8 @@ 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);", "create table TableTwo (iD int primary key, VAL2 int, vAL3 int);", @@ -4996,7 +5055,8 @@ CREATE TABLE tab3 ( }, }, { - 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';", @@ -5293,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);", @@ -5309,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);", @@ -5922,7 +5982,8 @@ 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);", "insert into t values (false);", @@ -5958,7 +6019,8 @@ 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));", "insert into t values (false);", @@ -6049,7 +6111,8 @@ 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;", "create table parent (i int primary key);", @@ -6066,7 +6129,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "between type conversion", + Name: "between type conversion", + Dialect: "mysql", SetUpScript: []string{ "create table t0(c0 bool);", "create table t1(c1 bool);", @@ -6120,7 +6184,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "bool and string", + Name: "bool and string", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE t0(c0 BOOL, PRIMARY KEY(c0));", "INSERT INTO t0 (c0) VALUES (true);", @@ -6150,7 +6215,8 @@ CREATE TABLE tab3 ( }, }, { - Name: "bool and int", + Name: "bool and int", + Dialect: "mysql", SetUpScript: []string{ "CREATE TABLE t0(c0 INTEGER, PRIMARY KEY(c0));", "INSERT INTO t0 (c0) VALUES (true);", @@ -6253,7 +6319,8 @@ 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));`, `INSERT INTO t0(c0) VALUES ('a');`, @@ -6890,7 +6957,6 @@ where {"12345", "1234567890"}, }, }, - { Query: "insert into t2 (a, b) values ('1234567890', '12345')", ExpectedErrStr: "string '1234567890' is too large for column 'a'", @@ -6953,7 +7019,8 @@ where }, }, { - Name: "test show create database", + Name: "test show create database", + Dialect: "mysql", SetUpScript: []string{ "create database def_db;", "create database latin1_db character set latin1;", @@ -6988,7 +7055,8 @@ 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';", "create database latin1_db;", @@ -7016,7 +7084,8 @@ where }, }, { - Name: "test index naming", + Name: "test index naming", + Dialect: "mysql", SetUpScript: []string{ "create table t (i int);", "alter table t add index (i);", @@ -7058,7 +7127,8 @@ where }, }, { - Name: "test parenthesized tables", + Name: "test parenthesized tables", + Dialect: "mysql", SetUpScript: []string{ "create table t1 (i int);", "insert into t1 values (1), (2), (3);", @@ -7160,7 +7230,8 @@ where }, }, { - Name: "unix_timestamp script tests", + Name: "unix_timestamp script tests", + Dialect: "mysql", SetUpScript: []string{ "set time_zone = 'UTC';", "create table t1 (i int primary key, v varchar(100));", @@ -7190,7 +7261,8 @@ where }, }, { - Name: "name_const queries", + Name: "name_const queries", + Dialect: "mysql", SetUpScript: []string{ "create table t (i int primary key);", "insert into t values (1), (2), (3);", diff --git a/enginetest/scriptgen/setup/scripts/autoincrement b/enginetest/scriptgen/setup/scripts/autoincrement index 91824a0e40..31e916d8af 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), + (33) ---- diff --git a/enginetest/scriptgen/setup/setup_data.sg.go b/enginetest/scriptgen/setup/setup_data.sg.go index 15018187c4..5e115de671 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), + (33)`, }} var BigtableData = []SetupScript{{