summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_clickhouse.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dialects/test_clickhouse.py')
-rw-r--r--tests/dialects/test_clickhouse.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/dialects/test_clickhouse.py b/tests/dialects/test_clickhouse.py
index 948c00e..93d1ced 100644
--- a/tests/dialects/test_clickhouse.py
+++ b/tests/dialects/test_clickhouse.py
@@ -6,6 +6,22 @@ class TestClickhouse(Validator):
dialect = "clickhouse"
def test_clickhouse(self):
+ self.validate_identity("x <> y")
+
+ self.validate_all(
+ "has([1], x)",
+ read={
+ "postgres": "x = any(array[1])",
+ },
+ )
+ self.validate_all(
+ "NOT has([1], x)",
+ read={
+ "postgres": "any(array[1]) <> x",
+ },
+ )
+ self.validate_identity("x = y")
+
string_types = [
"BLOB",
"LONGBLOB",
@@ -86,6 +102,39 @@ class TestClickhouse(Validator):
)
self.validate_all(
+ "SELECT CAST('2020-01-01' AS TIMESTAMP) + INTERVAL '500' microsecond",
+ read={
+ "duckdb": "SELECT TIMESTAMP '2020-01-01' + INTERVAL '500 us'",
+ "postgres": "SELECT TIMESTAMP '2020-01-01' + INTERVAL '500 us'",
+ },
+ )
+ self.validate_all(
+ "SELECT CURRENT_DATE()",
+ read={
+ "clickhouse": "SELECT CURRENT_DATE()",
+ "postgres": "SELECT CURRENT_DATE",
+ },
+ )
+ self.validate_all(
+ "SELECT CURRENT_TIMESTAMP()",
+ read={
+ "clickhouse": "SELECT CURRENT_TIMESTAMP()",
+ "postgres": "SELECT CURRENT_TIMESTAMP",
+ },
+ )
+ self.validate_all(
+ "SELECT match('ThOmAs', CONCAT('(?i)', 'thomas'))",
+ read={
+ "postgres": "SELECT 'ThOmAs' ~* 'thomas'",
+ },
+ )
+ self.validate_all(
+ "SELECT match('ThOmAs', CONCAT('(?i)', x)) FROM t",
+ read={
+ "postgres": "SELECT 'ThOmAs' ~* x FROM t",
+ },
+ )
+ self.validate_all(
"SELECT '\\0'",
read={
"mysql": "SELECT '\0'",