diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-02-08 05:38:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-02-08 05:38:39 +0000 |
commit | aedf35026379f52d7e2b4c1f957691410a758089 (patch) | |
tree | 86540364259b66741173d2333387b78d6f9c31e2 /tests/dialects/test_mysql.py | |
parent | Adding upstream version 20.11.0. (diff) | |
download | sqlglot-a74f3586b6fe3f3fa157614e3407f4a5938b87b6.tar.xz sqlglot-a74f3586b6fe3f3fa157614e3407f4a5938b87b6.zip |
Adding upstream version 21.0.1.upstream/21.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_mysql.py')
-rw-r--r-- | tests/dialects/test_mysql.py | 24 |
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") |