summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_redshift.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-11-01 05:12:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-11-01 05:12:38 +0000
commit613c2506f59fefeb0c0b921ca361c65e99458139 (patch)
treee1207c41ee9b35d77f1608e87e568fe60d701cf6 /tests/dialects/test_redshift.py
parentAdding upstream version 18.17.0. (diff)
downloadsqlglot-613c2506f59fefeb0c0b921ca361c65e99458139.tar.xz
sqlglot-613c2506f59fefeb0c0b921ca361c65e99458139.zip
Adding upstream version 19.0.1.upstream/19.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_redshift.py')
-rw-r--r--tests/dialects/test_redshift.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/dialects/test_redshift.py b/tests/dialects/test_redshift.py
index c848010..3e42525 100644
--- a/tests/dialects/test_redshift.py
+++ b/tests/dialects/test_redshift.py
@@ -7,9 +7,25 @@ class TestRedshift(Validator):
def test_redshift(self):
self.validate_identity(
+ "SELECT DATE_DIFF('month', CAST('2020-02-29 00:00:00' AS TIMESTAMP), CAST('2020-03-02 00:00:00' AS TIMESTAMP))",
+ "SELECT DATEDIFF(month, CAST(CAST('2020-02-29 00:00:00' AS TIMESTAMP) AS DATE), CAST(CAST('2020-03-02 00:00:00' AS TIMESTAMP) AS DATE))",
+ )
+ self.validate_identity(
"SELECT * FROM x WHERE y = DATEADD('month', -1, DATE_TRUNC('month', (SELECT y FROM #temp_table)))",
"SELECT * FROM x WHERE y = DATEADD(month, -1, CAST(DATE_TRUNC('month', (SELECT y FROM #temp_table)) AS DATE))",
)
+
+ self.validate_all(
+ "LISTAGG(sellerid, ', ')",
+ read={
+ "duckdb": "STRING_AGG(sellerid, ', ')",
+ },
+ write={
+ # GROUP_CONCAT and STRING_AGG are aliases in DuckDB
+ "duckdb": "GROUP_CONCAT(sellerid, ', ')",
+ "redshift": "LISTAGG(sellerid, ', ')",
+ },
+ )
self.validate_all(
"SELECT APPROXIMATE COUNT(DISTINCT y)",
read={