Skip to content

Commit 1c2dfd2

Browse files
committed
mysql dialect work
1 parent 20c1d22 commit 1c2dfd2

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

enginetest/queries/script_queries.go

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2442,6 +2442,7 @@ CREATE TABLE tab3 (
24422442
},
24432443
{
24442444
Name: "found_rows() behavior",
2445+
Dialect: "mysql",
24452446
SetUpScript: []string{
24462447
"create table b (x int primary key)",
24472448
"insert into b values (1), (2), (3), (4)",
@@ -2734,7 +2735,8 @@ CREATE TABLE tab3 (
27342735
},
27352736
},
27362737
{
2737-
Name: "ALTER TABLE, ALTER COLUMN SET , DROP DEFAULT",
2738+
Name: "ALTER TABLE, ALTER COLUMN SET, DROP DEFAULT",
2739+
Dialect: "mysql",
27382740
SetUpScript: []string{
27392741
"CREATE TABLE test (pk BIGINT PRIMARY KEY, v1 BIGINT NOT NULL DEFAULT 88);",
27402742
},
@@ -2990,6 +2992,7 @@ CREATE TABLE tab3 (
29902992
},
29912993
{
29922994
Name: "unix_timestamp function usage",
2995+
Dialect: "mysql",
29932996
SetUpScript: []string{
29942997
// NOTE: session time zone needs to be set as UNIX_TIMESTAMP function depends on it and converts the final result
29952998
"SET @@SESSION.time_zone = 'UTC';",
@@ -3014,6 +3017,7 @@ CREATE TABLE tab3 (
30143017
},
30153018
{
30163019
Name: "unix_timestamp with non UTC timezone",
3020+
Dialect: "mysql",
30173021
SetUpScript: []string{
30183022
"SET @@SESSION.time_zone = 'UTC';",
30193023
"CREATE TABLE `datetime_table` ( `i` bigint NOT NULL, `datetime_col` datetime, `timestamp_col` timestamp, PRIMARY KEY (`i`) )",
@@ -3031,6 +3035,7 @@ CREATE TABLE tab3 (
30313035
},
30323036
{
30333037
Name: "Issue #499", // https://github.com/dolthub/go-mysql-server/issues/499
3038+
Dialect: "mysql",
30343039
SetUpScript: []string{
30353040
"SET @@SESSION.time_zone = 'UTC';",
30363041
"CREATE TABLE test (time TIMESTAMP, value DOUBLE);",
@@ -3065,6 +3070,7 @@ CREATE TABLE tab3 (
30653070
},
30663071
{
30673072
Name: "WHERE clause considers ENUM/SET types for comparisons",
3073+
Dialect: "mysql",
30683074
SetUpScript: []string{
30693075
"CREATE TABLE test (pk BIGINT PRIMARY KEY, v1 ENUM('a', 'b', 'c'), v2 SET('a', 'b', 'c'));",
30703076
"INSERT INTO test VALUES (1, 2, 2), (2, 1, 1);",
@@ -3109,6 +3115,7 @@ CREATE TABLE tab3 (
31093115
},
31103116
{
31113117
Name: "Simple Update Join test that manipulates two tables",
3118+
Dialect: "mysql",
31123119
SetUpScript: []string{
31133120
"CREATE TABLE test (pk int primary key);",
31143121
`CREATE TABLE test2 (pk int primary key, val int);`,
@@ -3238,6 +3245,7 @@ CREATE TABLE tab3 (
32383245
},
32393246
{
32403247
Name: "Ensure scale is not rounded when inserting to DECIMAL type through float64",
3248+
Dialect: "mysql",
32413249
SetUpScript: []string{
32423250
"create table test (number decimal(40,16));",
32433251
"insert into test values ('11981.5923291839784651');",
@@ -3471,6 +3479,7 @@ CREATE TABLE tab3 (
34713479
},
34723480
{
34733481
Name: "Multialter DDL with ADD/DROP Primary Key",
3482+
Dialect: "mysql",
34743483
SetUpScript: []string{
34753484
"CREATE TABLE t(pk int primary key, v1 int)",
34763485
},
@@ -3503,6 +3512,7 @@ CREATE TABLE tab3 (
35033512
},
35043513
{
35053514
Name: "Multialter DDL with ADD/DROP INDEX",
3515+
Dialect: "mysql",
35063516
SetUpScript: []string{
35073517
"CREATE TABLE t(pk int primary key, v1 int)",
35083518
},
@@ -3623,6 +3633,7 @@ CREATE TABLE tab3 (
36233633
},
36243634
{
36253635
Query: "show create table test",
3636+
Dialect: "mysql",
36263637
Expected: []sql.Row{
36273638
{"test", "CREATE TABLE `test` (\n `i` int DEFAULT '999',\n `j` json DEFAULT ('[]')\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"},
36283639
},
@@ -3631,6 +3642,7 @@ CREATE TABLE tab3 (
36313642
},
36323643
{
36333644
Name: "ALTER TABLE MULTI ADD/DROP COLUMN",
3645+
Dialect: "mysql",
36343646
SetUpScript: []string{
36353647
"CREATE TABLE test (pk BIGINT PRIMARY KEY, v1 BIGINT NOT NULL DEFAULT 88);",
36363648
},
@@ -3727,6 +3739,7 @@ CREATE TABLE tab3 (
37273739
},
37283740
{
37293741
Name: "describe and show columns with various keys and constraints",
3742+
Dialect: "mysql",
37303743
SetUpScript: []string{
37313744
"create table t1 (i int not null, unique key (i));",
37323745
"create table t2 (i int not null, j int not null, unique key (j), unique key(i));",
@@ -3820,6 +3833,7 @@ CREATE TABLE tab3 (
38203833
},
38213834
{
38223835
Name: "ALTER TABLE MODIFY column with multiple UNIQUE KEYS",
3836+
Dialect: "mysql",
38233837
SetUpScript: []string{
38243838
"CREATE table test (pk int primary key, uk1 int, uk2 int, unique(uk1, uk2))",
38253839
"ALTER TABLE `test` MODIFY column uk1 int auto_increment",
@@ -3837,6 +3851,7 @@ CREATE TABLE tab3 (
38373851
},
38383852
{
38393853
Name: "ALTER TABLE MODIFY column with multiple KEYS",
3854+
Dialect: "mysql",
38403855
SetUpScript: []string{
38413856
"CREATE table test (pk int primary key, mk1 int, mk2 int, index(mk1, mk2))",
38423857
"ALTER TABLE `test` MODIFY column mk1 int auto_increment",
@@ -3873,6 +3888,7 @@ CREATE TABLE tab3 (
38733888
},
38743889
{
38753890
Name: "failed conversion shows warning",
3891+
Dialect: "mysql",
38763892
Assertions: []ScriptTestAssertion{
38773893
{
38783894
Query: "SELECT CONVERT('10000-12-31 23:59:59', DATETIME)",
@@ -3913,6 +3929,7 @@ CREATE TABLE tab3 (
39133929
},
39143930
{
39153931
Name: "Describe with expressions and views work correctly",
3932+
Dialect: "mysql",
39163933
SetUpScript: []string{
39173934
"CREATE TABLE t(pk int primary key, val int DEFAULT (pk * 2))",
39183935
},
@@ -3928,6 +3945,7 @@ CREATE TABLE tab3 (
39283945
},
39293946
{
39303947
Name: "Check support for deprecated BINARY attribute after character set",
3948+
Dialect: "mysql",
39313949
SetUpScript: []string{
39323950
"CREATE TABLE test (pk BIGINT PRIMARY KEY, v1 VARCHAR(255) COLLATE utf8mb4_0900_bin);",
39333951
},
@@ -4015,6 +4033,7 @@ CREATE TABLE tab3 (
40154033
},
40164034
{
40174035
Name: "basic test on tables dual and `dual`",
4036+
Dialect: "mysql",
40184037
SetUpScript: []string{
40194038
"CREATE TABLE `dual` (id int)",
40204039
"INSERT INTO `dual` VALUES (2)",
@@ -4029,6 +4048,7 @@ CREATE TABLE tab3 (
40294048
Expected: []sql.Row{{3}},
40304049
},
40314050
{
4051+
Dialect: "mysql",
40324052
Query: "SELECT * from dual;",
40334053
ExpectedErr: sql.ErrNoTablesUsed,
40344054
},
@@ -4135,15 +4155,15 @@ CREATE TABLE tab3 (
41354155
},
41364156
Assertions: []ScriptTestAssertion{
41374157
{
4138-
Query: "create view t as select 1 from dual",
4158+
Query: "create view t as select 1",
41394159
ExpectedErr: sql.ErrTableAlreadyExists,
41404160
},
41414161
},
41424162
},
41434163
{
41444164
Name: "can't create table with same name as existing view",
41454165
SetUpScript: []string{
4146-
"create view t as select 1 from dual",
4166+
"create view t as select 1",
41474167
},
41484168
Assertions: []ScriptTestAssertion{
41494169
{
@@ -4190,13 +4210,15 @@ CREATE TABLE tab3 (
41904210
{1.9230769936149668}, {2.083333250549108}, {2.272727223467237}},
41914211
},
41924212
{
4213+
Dialect: "mysql",
41934214
Query: `select f/'a' from floats;`,
41944215
Expected: []sql.Row{{nil}, {nil}, {nil}},
41954216
},
41964217
},
41974218
},
41984219
{
41994220
Name: "'%' mod operation result in decimal or float",
4221+
Dialect: "mysql", // % operator between types not defined in other dialects
42004222
SetUpScript: []string{
42014223
"create table a (pk int primary key, c1 int, c2 double, c3 decimal(5,3));",
42024224
"insert into a values (1, 1, 1.111, 1.111), (2, 2, 2.111, 2.111);",
@@ -4254,6 +4276,7 @@ CREATE TABLE tab3 (
42544276
},
42554277
{
42564278
Name: "year type behavior",
4279+
Dialect: "mysql",
42574280
SetUpScript: []string{
42584281
"create table t (pk int primary key, col1 year);",
42594282
},
@@ -4338,6 +4361,7 @@ CREATE TABLE tab3 (
43384361
},
43394362
{
43404363
Name: "INSERT IGNORE correctly truncates column data",
4364+
Dialect: "mysql",
43414365
SetUpScript: []string{
43424366
`CREATE TABLE t (
43434367
pk int primary key,
@@ -4424,6 +4448,7 @@ CREATE TABLE tab3 (
44244448
},
44254449
{
44264450
Name: "hash lookup for joins works with binary",
4451+
Dialect: "mysql",
44274452
SetUpScript: []string{
44284453
"create table uv (u int primary key, v int);",
44294454
"create table xy (x int primary key, y int);",
@@ -4443,6 +4468,7 @@ CREATE TABLE tab3 (
44434468
},
44444469
{
44454470
Name: "enum columns work as expected in when clauses",
4471+
Dialect: "mysql",
44464472
SetUpScript: []string{
44474473
"create table enums (e enum('a'));",
44484474
"insert into enums values ('a');",
@@ -4460,6 +4486,7 @@ CREATE TABLE tab3 (
44604486
},
44614487
{
44624488
Name: "SET and ENUM properly handle integers using UPDATE and DELETE statements",
4489+
Dialect: "mysql",
44634490
SetUpScript: []string{
44644491
"CREATE TABLE setenumtest (pk INT PRIMARY KEY, v1 ENUM('a', 'b', 'c'), v2 SET('a', 'b', 'c'));",
44654492
},
@@ -4592,6 +4619,7 @@ CREATE TABLE tab3 (
45924619
},
45934620
{
45944621
Name: "drop table if exists on unknown table shows warning",
4622+
Dialect: "mysql",
45954623
Assertions: []ScriptTestAssertion{
45964624
{
45974625
Query: "DROP TABLE IF EXISTS non_existent_table;",
@@ -4604,6 +4632,7 @@ CREATE TABLE tab3 (
46044632
},
46054633
{
46064634
Name: "find_in_set tests",
4635+
Dialect: "mysql",
46074636
SetUpScript: []string{
46084637
"create table set_tbl (i int primary key, s set('a','b','c'));",
46094638
"insert into set_tbl values (0, '');",
@@ -4668,6 +4697,7 @@ CREATE TABLE tab3 (
46684697
},
46694698
{
46704699
Name: "coalesce tests",
4700+
Dialect: "mysql",
46714701
SetUpScript: []string{
46724702
"create table c select coalesce(NULL, 1);",
46734703
},
@@ -4704,6 +4734,7 @@ CREATE TABLE tab3 (
47044734
},
47054735
{
47064736
Name: "renaming views with RENAME TABLE ... TO .. statement",
4737+
Dialect: "mysql",
47074738
SetUpScript: []string{
47084739
"create table t1 (id int primary key, v1 int);",
47094740
"create view v1 as select * from t1;",
@@ -4733,6 +4764,7 @@ CREATE TABLE tab3 (
47334764
},
47344765
{
47354766
Name: "renaming views with ALTER TABLE ... RENAME .. statement should fail",
4767+
Dialect: "mysql",
47364768
SetUpScript: []string{
47374769
"create table t1 (id int primary key, v1 int);",
47384770
"create view v1 as select * from t1;",
@@ -4754,6 +4786,7 @@ CREATE TABLE tab3 (
47544786
},
47554787
{
47564788
Name: "timezone default settings",
4789+
Dialect: "mysql",
47574790
Assertions: []ScriptTestAssertion{
47584791
{
47594792
// TODO: Skipping this test while we figure out why this change causes the mysql java
@@ -4773,6 +4806,7 @@ CREATE TABLE tab3 (
47734806
},
47744807
{
47754808
Name: "current time functions",
4809+
Dialect: "mysql",
47764810
Assertions: []ScriptTestAssertion{
47774811
{
47784812
// Smoke test that NOW() and UTC_TIMESTAMP() return non-null values with the SYSTEM time zone
@@ -4818,6 +4852,7 @@ CREATE TABLE tab3 (
48184852
},
48194853
{
48204854
Name: "timestamp timezone conversion",
4855+
Dialect: "mysql",
48214856
SetUpScript: []string{
48224857
"set time_zone='+00:00';",
48234858
"create table timezonetest(pk int primary key, dt datetime, ts timestamp);",
@@ -4922,6 +4957,7 @@ CREATE TABLE tab3 (
49224957
},
49234958
{
49244959
Name: "case insensitive index handling",
4960+
Dialect: "mysql",
49254961
SetUpScript: []string{
49264962
"create table table_One (Id int primary key, Val1 int);",
49274963
"create table TableTwo (iD int primary key, VAL2 int, vAL3 int);",
@@ -5019,6 +5055,7 @@ CREATE TABLE tab3 (
50195055
},
50205056
},
50215057
{
5058+
Dialect: "mysql",
50225059
Name: "UNIX_TIMESTAMP function usage with session different time zones",
50235060
Assertions: []ScriptTestAssertion{
50245061
{
@@ -5053,6 +5090,7 @@ CREATE TABLE tab3 (
50535090
},
50545091
{
50555092
Name: "Querying existing view that references non-existing table",
5093+
Dialect: "mysql",
50565094
SetUpScript: []string{
50575095
"CREATE TABLE a(id int primary key, col1 int);",
50585096
"CREATE VIEW b AS SELECT * FROM a;",

0 commit comments

Comments
 (0)