summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_tsql.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_tsql.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_tsql.py')
-rw-r--r--tests/dialects/test_tsql.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/dialects/test_tsql.py b/tests/dialects/test_tsql.py
index a60f48d..afdd48a 100644
--- a/tests/dialects/test_tsql.py
+++ b/tests/dialects/test_tsql.py
@@ -17,7 +17,6 @@ class TestTSQL(Validator):
"spark": "SELECT CAST(`a`.`b` AS SHORT) FROM foo",
},
)
-
self.validate_all(
"CONVERT(INT, CONVERT(NUMERIC, '444.75'))",
write={
@@ -25,6 +24,33 @@ class TestTSQL(Validator):
"tsql": "CAST(CAST('444.75' AS NUMERIC) AS INTEGER)",
},
)
+ self.validate_all(
+ "STRING_AGG(x, y) WITHIN GROUP (ORDER BY z DESC)",
+ write={
+ "tsql": "STRING_AGG(x, y) WITHIN GROUP (ORDER BY z DESC)",
+ "mysql": "GROUP_CONCAT(x ORDER BY z DESC SEPARATOR y)",
+ "sqlite": "GROUP_CONCAT(x, y)",
+ "postgres": "STRING_AGG(x, y ORDER BY z DESC NULLS LAST)",
+ },
+ )
+ self.validate_all(
+ "STRING_AGG(x, '|') WITHIN GROUP (ORDER BY z ASC)",
+ write={
+ "tsql": "STRING_AGG(x, '|') WITHIN GROUP (ORDER BY z)",
+ "mysql": "GROUP_CONCAT(x ORDER BY z SEPARATOR '|')",
+ "sqlite": "GROUP_CONCAT(x, '|')",
+ "postgres": "STRING_AGG(x, '|' ORDER BY z NULLS FIRST)",
+ },
+ )
+ self.validate_all(
+ "STRING_AGG(x, '|')",
+ write={
+ "tsql": "STRING_AGG(x, '|')",
+ "mysql": "GROUP_CONCAT(x SEPARATOR '|')",
+ "sqlite": "GROUP_CONCAT(x, '|')",
+ "postgres": "STRING_AGG(x, '|')",
+ },
+ )
def test_types(self):
self.validate_identity("CAST(x AS XML)")