Skip to content

Commit

Permalink
Fix(snowflake): cast to TimeToStr arg to TIMESTAMP more conservatively
Browse files Browse the repository at this point in the history
  • Loading branch information
georgesittas committed Nov 17, 2024
1 parent 835e717 commit 0479743
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions sqlglot/dialects/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -1152,8 +1152,7 @@ def jsonextract_sql(self, expression: exp.JSONExtract):

def timetostr_sql(self, expression: exp.TimeToStr) -> str:
this = expression.this

if this.is_string:
if not isinstance(this, exp.TsOrDsToTimestamp):
this = exp.cast(this, exp.DataType.Type.TIMESTAMP)

return self.func("TO_CHAR", this, self.format_time(expression))

0 comments on commit 0479743

Please sign in to comment.