summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_postgres.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-10 08:53:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-10 08:53:10 +0000
commitf7cb7fdb0fb5a8e2d053c1aa18dd98462401a64e (patch)
tree75bbd792c82b8d1e70b5561de82a5b270b61867c /tests/dialects/test_postgres.py
parentAdding upstream version 18.11.2. (diff)
downloadsqlglot-f7cb7fdb0fb5a8e2d053c1aa18dd98462401a64e.tar.xz
sqlglot-f7cb7fdb0fb5a8e2d053c1aa18dd98462401a64e.zip
Adding upstream version 18.11.6.upstream/18.11.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_postgres.py')
-rw-r--r--tests/dialects/test_postgres.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/dialects/test_postgres.py b/tests/dialects/test_postgres.py
index 0ddc106..22bede4 100644
--- a/tests/dialects/test_postgres.py
+++ b/tests/dialects/test_postgres.py
@@ -648,10 +648,10 @@ class TestPostgres(Validator):
},
)
self.validate_all(
- "merge into x as x using (select id) as y on a = b WHEN matched then update set X.a = y.b",
+ """merge into x as x using (select id) as y on a = b WHEN matched then update set X."A" = y.b""",
write={
- "postgres": "MERGE INTO x AS x USING (SELECT id) AS y ON a = b WHEN MATCHED THEN UPDATE SET a = y.b",
- "snowflake": "MERGE INTO x AS x USING (SELECT id) AS y ON a = b WHEN MATCHED THEN UPDATE SET X.a = y.b",
+ "postgres": """MERGE INTO x AS x USING (SELECT id) AS y ON a = b WHEN MATCHED THEN UPDATE SET "A" = y.b""",
+ "snowflake": """MERGE INTO x AS x USING (SELECT id) AS y ON a = b WHEN MATCHED THEN UPDATE SET X."A" = y.b""",
},
)
self.validate_all(
@@ -724,3 +724,11 @@ class TestPostgres(Validator):
"presto": "CONCAT(CAST(a AS VARCHAR), CAST(b AS VARCHAR))",
},
)
+
+ def test_variance(self):
+ self.validate_all("VAR_SAMP(x)", write={"postgres": "VAR_SAMP(x)"})
+ self.validate_all("VAR_POP(x)", write={"postgres": "VAR_POP(x)"})
+ self.validate_all("VARIANCE(x)", write={"postgres": "VAR_SAMP(x)"})
+ self.validate_all(
+ "VAR_POP(x)", read={"": "VARIANCE_POP(x)"}, write={"postgres": "VAR_POP(x)"}
+ )