summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_postgres.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-12-19 11:01:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-12-19 11:01:36 +0000
commit948a422be120c069e48c63a8770fec7204307897 (patch)
tree80bc02d5e6cd3527409386aa1d706272bea54e6c /tests/dialects/test_postgres.py
parentAdding upstream version 20.1.0. (diff)
downloadsqlglot-948a422be120c069e48c63a8770fec7204307897.tar.xz
sqlglot-948a422be120c069e48c63a8770fec7204307897.zip
Adding upstream version 20.3.0.upstream/20.3.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.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/dialects/test_postgres.py b/tests/dialects/test_postgres.py
index 17a65d7..9155696 100644
--- a/tests/dialects/test_postgres.py
+++ b/tests/dialects/test_postgres.py
@@ -8,6 +8,11 @@ class TestPostgres(Validator):
dialect = "postgres"
def test_ddl(self):
+ expr = parse_one("CREATE TABLE t (x INTERVAL day)", read="postgres")
+ cdef = expr.find(exp.ColumnDef)
+ cdef.args["kind"].assert_is(exp.DataType)
+ self.assertEqual(expr.sql(dialect="postgres"), "CREATE TABLE t (x INTERVAL day)")
+
self.validate_identity("CREATE INDEX idx_x ON x USING BTREE(x, y) WHERE (NOT y IS NULL)")
self.validate_identity("CREATE TABLE test (elems JSONB[])")
self.validate_identity("CREATE TABLE public.y (x TSTZRANGE NOT NULL)")
@@ -203,6 +208,8 @@ class TestPostgres(Validator):
self.validate_identity("SELECT 1 OPERATOR(pg_catalog.+) 2")
def test_postgres(self):
+ self.validate_identity("EXEC AS myfunc @id = 123")
+
expr = parse_one(
"SELECT * FROM r CROSS JOIN LATERAL UNNEST(ARRAY[1]) AS s(location)", read="postgres"
)