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:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-10 08:53:14 +0000
commitcd37a3bcaced9283c20baa52837c96b524baec54 (patch)
tree101b1c1487aa832a982dd635cd3b00d4d2ea3ae9 /tests/dialects/test_postgres.py
parentReleasing progress-linux version 18.11.2-1. (diff)
downloadsqlglot-cd37a3bcaced9283c20baa52837c96b524baec54.tar.xz
sqlglot-cd37a3bcaced9283c20baa52837c96b524baec54.zip
Merging upstream version 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)"}
+ )