summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_mysql.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-12-02 09:16:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-12-02 09:16:29 +0000
commit1a60bbae98d3b530924a6807a55f8250de19ea86 (patch)
tree87d3000f271a6604fff43db188731229aed918a8 /tests/dialects/test_mysql.py
parentAdding upstream version 10.0.8. (diff)
downloadsqlglot-1a60bbae98d3b530924a6807a55f8250de19ea86.tar.xz
sqlglot-1a60bbae98d3b530924a6807a55f8250de19ea86.zip
Adding upstream version 10.1.3.upstream/10.1.3
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.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/dialects/test_mysql.py b/tests/dialects/test_mysql.py
index af98249..5064dbe 100644
--- a/tests/dialects/test_mysql.py
+++ b/tests/dialects/test_mysql.py
@@ -23,6 +23,8 @@ class TestMySQL(Validator):
self.validate_identity("SELECT TRIM('bla' FROM ' XXX ')")
self.validate_identity("@@GLOBAL.max_connections")
+ self.validate_identity("CREATE TABLE A LIKE B")
+
# SET Commands
self.validate_identity("SET @var_name = expr")
self.validate_identity("SET @name = 43")
@@ -177,14 +179,27 @@ class TestMySQL(Validator):
"GROUP_CONCAT(DISTINCT x ORDER BY y DESC)",
write={
"mysql": "GROUP_CONCAT(DISTINCT x ORDER BY y DESC SEPARATOR ',')",
- "sqlite": "GROUP_CONCAT(DISTINCT x ORDER BY y DESC)",
+ "sqlite": "GROUP_CONCAT(DISTINCT x)",
+ "tsql": "STRING_AGG(x, ',') WITHIN GROUP (ORDER BY y DESC)",
+ "postgres": "STRING_AGG(DISTINCT x, ',' ORDER BY y DESC NULLS LAST)",
+ },
+ )
+ self.validate_all(
+ "GROUP_CONCAT(x ORDER BY y SEPARATOR z)",
+ write={
+ "mysql": "GROUP_CONCAT(x ORDER BY y SEPARATOR z)",
+ "sqlite": "GROUP_CONCAT(x, z)",
+ "tsql": "STRING_AGG(x, z) WITHIN GROUP (ORDER BY y)",
+ "postgres": "STRING_AGG(x, z ORDER BY y NULLS FIRST)",
},
)
self.validate_all(
"GROUP_CONCAT(DISTINCT x ORDER BY y DESC SEPARATOR '')",
write={
"mysql": "GROUP_CONCAT(DISTINCT x ORDER BY y DESC SEPARATOR '')",
- "sqlite": "GROUP_CONCAT(DISTINCT x ORDER BY y DESC, '')",
+ "sqlite": "GROUP_CONCAT(DISTINCT x, '')",
+ "tsql": "STRING_AGG(x, '') WITHIN GROUP (ORDER BY y DESC)",
+ "postgres": "STRING_AGG(DISTINCT x, '' ORDER BY y DESC NULLS LAST)",
},
)
self.validate_identity(