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:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-12-02 09:16:32 +0000
commitb3c7fe6a73484a4d2177c30f951cd11a4916ed56 (patch)
tree7192898cb782bbb0b9b13bd8d6341fe4434f0f31 /tests/dialects/test_tsql.py
parentReleasing debian version 10.0.8-1. (diff)
downloadsqlglot-b3c7fe6a73484a4d2177c30f951cd11a4916ed56.tar.xz
sqlglot-b3c7fe6a73484a4d2177c30f951cd11a4916ed56.zip
Merging upstream version 10.1.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-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)")