Skip to content

Commit

Permalink
Fix: redshift len->length closes #1741
Browse files Browse the repository at this point in the history
  • Loading branch information
tobymao committed Jun 7, 2023
1 parent 0cc09cf commit 6168fbf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sqlglot/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4167,7 +4167,7 @@ class Right(Func):


class Length(Func):
pass
_sql_names = ["LENGTH", "LEN"]


class Levenshtein(Func):
Expand Down
8 changes: 7 additions & 1 deletion tests/dialects/test_redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,20 @@ def test_redshift(self):
"presto": "NOT x",
},
)

self.validate_all(
"x is not false",
write={
"redshift": "NOT x IS FALSE",
"presto": "NOT NOT x",
},
)
self.validate_all(
"LEN(x)",
write={
"redshift": "LENGTH(x)",
"presto": "LENGTH(x)",
},
)

self.validate_all(
"SELECT SYSDATE",
Expand Down

0 comments on commit 6168fbf

Please sign in to comment.