summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_postgres.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-10-21 09:29:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-10-21 09:29:26 +0000
commit8b4272814fb4585be120f183eb7c26bb8acde974 (patch)
tree85d56a8f5ac4ac94ab924d5bbc578586eeb2a998 /tests/dialects/test_postgres.py
parentReleasing debian version 7.1.3-1. (diff)
downloadsqlglot-8b4272814fb4585be120f183eb7c26bb8acde974.tar.xz
sqlglot-8b4272814fb4585be120f183eb7c26bb8acde974.zip
Merging upstream version 9.0.1.
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.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/dialects/test_postgres.py b/tests/dialects/test_postgres.py
index 4b8f3c3..35141e2 100644
--- a/tests/dialects/test_postgres.py
+++ b/tests/dialects/test_postgres.py
@@ -69,6 +69,8 @@ class TestPostgres(Validator):
self.validate_identity("SELECT TRIM(LEADING 'bla' FROM ' XXX ' COLLATE utf8_bin)")
self.validate_identity("SELECT TO_TIMESTAMP(1284352323.5), TO_TIMESTAMP('05 Dec 2000', 'DD Mon YYYY')")
self.validate_identity("COMMENT ON TABLE mytable IS 'this'")
+ self.validate_identity("SELECT e'\\xDEADBEEF'")
+ self.validate_identity("SELECT CAST(e'\\176' AS BYTEA)")
self.validate_all(
"CREATE TABLE x (a UUID, b BYTEA)",
@@ -204,3 +206,11 @@ class TestPostgres(Validator):
"""'{"a":[1,2,3],"b":[4,5,6]}'::json#>>'{a,2}'""",
write={"postgres": """CAST('{"a":[1,2,3],"b":[4,5,6]}' AS JSON)#>>'{a,2}'"""},
)
+ self.validate_all(
+ "SELECT $$a$$",
+ write={"postgres": "SELECT 'a'"},
+ )
+ self.validate_all(
+ "SELECT $$Dianne's horse$$",
+ write={"postgres": "SELECT 'Dianne''s horse'"},
+ )