summaryrefslogtreecommitdiffstats
path: root/tests/test_build.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-31 05:44:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-31 05:44:37 +0000
commit5f8be2e0852f3c925fb873a48946caee3050899f (patch)
tree1f31666277e226f47180321c08be7ebbedc2780e /tests/test_build.py
parentAdding upstream version 20.9.0. (diff)
downloadsqlglot-5f8be2e0852f3c925fb873a48946caee3050899f.tar.xz
sqlglot-5f8be2e0852f3c925fb873a48946caee3050899f.zip
Adding upstream version 20.11.0.upstream/20.11.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_build.py')
-rw-r--r--tests/test_build.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_build.py b/tests/test_build.py
index 817b609..f0c631f 100644
--- a/tests/test_build.py
+++ b/tests/test_build.py
@@ -653,6 +653,18 @@ class TestBuild(unittest.TestCase):
lambda: exp.cast_unless("CAST(x AS TEXT)", "int", "int"),
"CAST(CAST(x AS TEXT) AS INT)",
),
+ (
+ lambda: exp.rename_column("table1", "c1", "c2", True),
+ "ALTER TABLE table1 RENAME COLUMN IF EXISTS c1 TO c2",
+ ),
+ (
+ lambda: exp.rename_column("table1", "c1", "c2", False),
+ "ALTER TABLE table1 RENAME COLUMN c1 TO c2",
+ ),
+ (
+ lambda: exp.rename_column("table1", "c1", "c2"),
+ "ALTER TABLE table1 RENAME COLUMN c1 TO c2",
+ ),
]:
with self.subTest(sql):
self.assertEqual(expression().sql(dialect[0] if dialect else None), sql)