summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_postgres.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-07 11:39:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-07 11:39:48 +0000
commitf73e9af131151f1e058446361c35b05c4c90bf10 (patch)
treeed425b89f12d3f5e4709290bdc03d876f365bc97 /tests/dialects/test_postgres.py
parentReleasing debian version 17.12.0-1. (diff)
downloadsqlglot-f73e9af131151f1e058446361c35b05c4c90bf10.tar.xz
sqlglot-f73e9af131151f1e058446361c35b05c4c90bf10.zip
Merging upstream version 18.2.0.
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.py52
1 files changed, 51 insertions, 1 deletions
diff --git a/tests/dialects/test_postgres.py b/tests/dialects/test_postgres.py
index a7719a9..8740aca 100644
--- a/tests/dialects/test_postgres.py
+++ b/tests/dialects/test_postgres.py
@@ -126,6 +126,8 @@ class TestPostgres(Validator):
)
def test_postgres(self):
+ self.validate_identity("x @@ y")
+
expr = parse_one("SELECT * FROM r CROSS JOIN LATERAL UNNEST(ARRAY[1]) AS s(location)")
unnest = expr.args["joins"][0].this.this
unnest.assert_is(exp.Unnest)
@@ -535,6 +537,54 @@ class TestPostgres(Validator):
write={"postgres": "CAST(x AS CSTRING)"},
)
self.validate_all(
+ "x::oid",
+ write={"postgres": "CAST(x AS OID)"},
+ )
+ self.validate_all(
+ "x::regclass",
+ write={"postgres": "CAST(x AS REGCLASS)"},
+ )
+ self.validate_all(
+ "x::regcollation",
+ write={"postgres": "CAST(x AS REGCOLLATION)"},
+ )
+ self.validate_all(
+ "x::regconfig",
+ write={"postgres": "CAST(x AS REGCONFIG)"},
+ )
+ self.validate_all(
+ "x::regdictionary",
+ write={"postgres": "CAST(x AS REGDICTIONARY)"},
+ )
+ self.validate_all(
+ "x::regnamespace",
+ write={"postgres": "CAST(x AS REGNAMESPACE)"},
+ )
+ self.validate_all(
+ "x::regoper",
+ write={"postgres": "CAST(x AS REGOPER)"},
+ )
+ self.validate_all(
+ "x::regoperator",
+ write={"postgres": "CAST(x AS REGOPERATOR)"},
+ )
+ self.validate_all(
+ "x::regproc",
+ write={"postgres": "CAST(x AS REGPROC)"},
+ )
+ self.validate_all(
+ "x::regprocedure",
+ write={"postgres": "CAST(x AS REGPROCEDURE)"},
+ )
+ self.validate_all(
+ "x::regrole",
+ write={"postgres": "CAST(x AS REGROLE)"},
+ )
+ self.validate_all(
+ "x::regtype",
+ write={"postgres": "CAST(x AS REGTYPE)"},
+ )
+ self.validate_all(
"TRIM(BOTH 'as' FROM 'as string as')",
write={
"postgres": "TRIM(BOTH 'as' FROM 'as string as')",
@@ -606,7 +656,7 @@ class TestPostgres(Validator):
"a || b",
write={
"": "a || b",
- "clickhouse": "CONCAT(CAST(a AS TEXT), CAST(b AS TEXT))",
+ "clickhouse": "CONCAT(CAST(a AS String), CAST(b AS String))",
"duckdb": "a || b",
"postgres": "a || b",
"presto": "CONCAT(CAST(a AS VARCHAR), CAST(b AS VARCHAR))",