diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-03 14:11:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-03 14:11:03 +0000 |
commit | 5d0ea770947ae1da51537ff75b14b48218d729aa (patch) | |
tree | 86e66fc69feeae4c4b23749e7779f6731791edcc /tests/test_build.py | |
parent | Adding upstream version 21.1.2. (diff) | |
download | sqlglot-5d0ea770947ae1da51537ff75b14b48218d729aa.tar.xz sqlglot-5d0ea770947ae1da51537ff75b14b48218d729aa.zip |
Adding upstream version 22.2.0.upstream/22.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_build.py')
-rw-r--r-- | tests/test_build.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_build.py b/tests/test_build.py index f0c631f..cdddd4f 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -94,6 +94,7 @@ class TestBuild(unittest.TestCase): (lambda: select("x").from_("tbl"), "SELECT x FROM tbl"), (lambda: select("x", "y").from_("tbl"), "SELECT x, y FROM tbl"), (lambda: select("x").select("y").from_("tbl"), "SELECT x, y FROM tbl"), + (lambda: select("comment", "begin"), "SELECT comment, begin"), ( lambda: select("x").select("y", append=False).from_("tbl"), "SELECT y FROM tbl", @@ -501,6 +502,25 @@ class TestBuild(unittest.TestCase): ), "SELECT x FROM (SELECT x FROM tbl UNION SELECT x FROM bar) AS unioned", ), + (lambda: parse_one("(SELECT 1)").select("2"), "(SELECT 1, 2)"), + ( + lambda: parse_one("(SELECT 1)").limit(1), + "SELECT * FROM ((SELECT 1)) AS _l_0 LIMIT 1", + ), + ( + lambda: parse_one("WITH t AS (SELECT 1) (SELECT 1)").limit(1), + "SELECT * FROM (WITH t AS (SELECT 1) (SELECT 1)) AS _l_0 LIMIT 1", + ), + ( + lambda: parse_one("(SELECT 1 LIMIT 2)").limit(1), + "SELECT * FROM ((SELECT 1 LIMIT 2)) AS _l_0 LIMIT 1", + ), + (lambda: parse_one("(SELECT 1)").subquery(), "((SELECT 1))"), + (lambda: parse_one("(SELECT 1)").subquery("alias"), "((SELECT 1)) AS alias"), + ( + lambda: parse_one("(select * from foo)").with_("foo", "select 1 as c"), + "WITH foo AS (SELECT 1 AS c) (SELECT * FROM foo)", + ), ( lambda: exp.update("tbl", {"x": None, "y": {"x": 1}}), "UPDATE tbl SET x = NULL, y = MAP(ARRAY('x'), ARRAY(1))", |