diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-11-01 05:12:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-11-01 05:12:42 +0000 |
commit | c51a9844b869fd7cd69e5cc7658d34f61a865185 (patch) | |
tree | 55706c65ce7e19626aabf7ff4dde0e1a51b739db /tests/dialects/test_redshift.py | |
parent | Releasing debian version 18.17.0-1. (diff) | |
download | sqlglot-c51a9844b869fd7cd69e5cc7658d34f61a865185.tar.xz sqlglot-c51a9844b869fd7cd69e5cc7658d34f61a865185.zip |
Merging upstream version 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.py | 16 |
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={ |