summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_mysql.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dialects/test_mysql.py')
-rw-r--r--tests/dialects/test_mysql.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/dialects/test_mysql.py b/tests/dialects/test_mysql.py
index 3a3e49e..fd27a1e 100644
--- a/tests/dialects/test_mysql.py
+++ b/tests/dialects/test_mysql.py
@@ -386,7 +386,6 @@ class TestMySQL(Validator):
"snowflake": "SELECT 11",
"spark": "SELECT 11",
"sqlite": "SELECT 11",
- "mysql": "SELECT b'1011'",
"tableau": "SELECT 11",
"teradata": "SELECT 11",
"trino": "SELECT 11",
@@ -591,6 +590,26 @@ class TestMySQL(Validator):
def test_mysql(self):
self.validate_all(
+ "SELECT JSON_EXTRACT('[10, 20, [30, 40]]', '$[1]')",
+ read={
+ "sqlite": "SELECT JSON_EXTRACT('[10, 20, [30, 40]]', '$[1]')",
+ },
+ write={
+ "mysql": "SELECT JSON_EXTRACT('[10, 20, [30, 40]]', '$[1]')",
+ "sqlite": "SELECT '[10, 20, [30, 40]]' -> '$[1]'",
+ },
+ )
+ self.validate_all(
+ "SELECT JSON_EXTRACT('[10, 20, [30, 40]]', '$[1]', '$[0]')",
+ read={
+ "sqlite": "SELECT JSON_EXTRACT('[10, 20, [30, 40]]', '$[1]', '$[0]')",
+ },
+ write={
+ "mysql": "SELECT JSON_EXTRACT('[10, 20, [30, 40]]', '$[1]', '$[0]')",
+ "sqlite": "SELECT JSON_EXTRACT('[10, 20, [30, 40]]', '$[1]', '$[0]')",
+ },
+ )
+ self.validate_all(
"SELECT * FROM x LEFT JOIN y ON x.id = y.id UNION SELECT * FROM x RIGHT JOIN y ON x.id = y.id LIMIT 0",
read={
"postgres": "SELECT * FROM x FULL JOIN y ON x.id = y.id LIMIT 0",
@@ -790,6 +809,7 @@ COMMENT='客户账户表'"""
("CHARACTER SET", "CHARACTER SET"),
("COLLATION", "COLLATION"),
("DATABASES", "DATABASES"),
+ ("SCHEMAS", "DATABASES"),
("FUNCTION STATUS", "FUNCTION STATUS"),
("PROCEDURE STATUS", "PROCEDURE STATUS"),
("GLOBAL STATUS", "GLOBAL STATUS"),
@@ -850,7 +870,7 @@ COMMENT='客户账户表'"""
self.assertEqual(show.text("target"), "foo")
def test_show_grants(self):
- show = self.validate_identity(f"SHOW GRANTS FOR foo")
+ show = self.validate_identity("SHOW GRANTS FOR foo")
self.assertIsInstance(show, exp.Show)
self.assertEqual(show.name, "GRANTS")
self.assertEqual(show.text("target"), "foo")