Skip to content

Commit

Permalink
Fix(oracle): remove COALESCE -> NVL mapping fixes #2158
Browse files Browse the repository at this point in the history
  • Loading branch information
georgesittas committed Sep 5, 2023
1 parent 585d0bf commit f0bddde
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 0 additions & 1 deletion sqlglot/dialects/oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ class Generator(generator.Generator):
),
exp.Group: transforms.preprocess([transforms.unalias_group]),
exp.ILike: no_ilike_sql,
exp.Coalesce: rename_func("NVL"),
exp.Select: transforms.preprocess([transforms.eliminate_distinct_on]),
exp.StrToTime: lambda self, e: f"TO_TIMESTAMP({self.sql(e, 'this')}, {self.format_time(e)})",
exp.Subquery: lambda self, e: self.subquery_sql(e, sep=" "),
Expand Down
3 changes: 2 additions & 1 deletion tests/dialects/test_oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class TestOracle(Validator):
dialect = "oracle"

def test_oracle(self):
self.validate_identity("COALESCE(c1, c2, c3)")
self.validate_identity("SELECT * FROM TABLE(foo)")
self.validate_identity("SELECT a$x#b")
self.validate_identity("SELECT :OBJECT")
Expand Down Expand Up @@ -43,7 +44,7 @@ def test_oracle(self):
"NVL(NULL, 1)",
write={
"": "COALESCE(NULL, 1)",
"oracle": "NVL(NULL, 1)",
"oracle": "COALESCE(NULL, 1)",
},
)
self.validate_all(
Expand Down

0 comments on commit f0bddde

Please sign in to comment.