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:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-10-21 09:29:23 +0000
commitdab6ba29e8eb9a5c2890ac3be8eab6e994aeb10e (patch)
tree0d209cfc6f7b9c794c254601c29aa5d8b9414876 /tests/dialects/test_postgres.py
parentAdding upstream version 7.1.3. (diff)
downloadsqlglot-dab6ba29e8eb9a5c2890ac3be8eab6e994aeb10e.tar.xz
sqlglot-dab6ba29e8eb9a5c2890ac3be8eab6e994aeb10e.zip
Adding upstream version 9.0.1.upstream/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'"},
+ )