summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_tsql.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-08-10 09:23:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-08-10 09:23:46 +0000
commit5dde903f4f6659e384287a3e508b9f369c5a2ba3 (patch)
tree05cd2920d82f0023f6ac695dbb6eaeef64608401 /tests/dialects/test_tsql.py
parentAdding upstream version 17.9.1. (diff)
downloadsqlglot-5dde903f4f6659e384287a3e508b9f369c5a2ba3.tar.xz
sqlglot-5dde903f4f6659e384287a3e508b9f369c5a2ba3.zip
Adding upstream version 17.11.0.upstream/17.11.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_tsql.py')
-rw-r--r--tests/dialects/test_tsql.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/dialects/test_tsql.py b/tests/dialects/test_tsql.py
index 5266bd4..f43b41b 100644
--- a/tests/dialects/test_tsql.py
+++ b/tests/dialects/test_tsql.py
@@ -6,6 +6,10 @@ class TestTSQL(Validator):
dialect = "tsql"
def test_tsql(self):
+ projection = parse_one("SELECT a = 1", read="tsql").selects[0]
+ projection.assert_is(exp.Alias)
+ projection.args["alias"].assert_is(exp.Identifier)
+
self.validate_identity("UPDATE x SET y = 1 OUTPUT x.a, x.b INTO @y FROM y")
self.validate_identity("UPDATE x SET y = 1 OUTPUT x.a, x.b FROM y")
self.validate_identity("INSERT INTO x (y) OUTPUT x.a, x.b INTO l SELECT * FROM z")
@@ -25,6 +29,10 @@ class TestTSQL(Validator):
self.validate_identity('SELECT "x"."y" FROM foo')
self.validate_identity("SELECT * FROM #foo")
self.validate_identity("SELECT * FROM ##foo")
+ self.validate_identity("SELECT a = 1", "SELECT 1 AS a")
+ self.validate_identity(
+ "SELECT a = 1 UNION ALL SELECT a = b", "SELECT 1 AS a UNION ALL SELECT b AS a"
+ )
self.validate_identity(
"SELECT x FROM @MyTableVar AS m JOIN Employee ON m.EmployeeID = Employee.EmployeeID"
)