Skip to content

Commit 0479743

Browse files
committed
Fix(snowflake): cast to TimeToStr arg to TIMESTAMP more conservatively
1 parent 835e717 commit 0479743

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sqlglot/dialects/snowflake.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,8 +1152,7 @@ def jsonextract_sql(self, expression: exp.JSONExtract):
11521152

11531153
def timetostr_sql(self, expression: exp.TimeToStr) -> str:
11541154
this = expression.this
1155-
1156-
if this.is_string:
1155+
if not isinstance(this, exp.TsOrDsToTimestamp):
11571156
this = exp.cast(this, exp.DataType.Type.TIMESTAMP)
11581157

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

0 commit comments

Comments
 (0)