We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f9bb9dc commit 5dec790Copy full SHA for 5dec790
sqlglot/dialects/duckdb.py
@@ -2453,11 +2453,11 @@ def hexstring_sql(
2453
2454
def datetrunc_sql(self, expression: exp.DateTrunc) -> str:
2455
unit = unit_to_str(expression)
2456
- timestamp = expression.this
2457
- result = self.func("DATE_TRUNC", unit, timestamp)
+ date = expression.this
+ result = self.func("DATE_TRUNC", unit, date)
2458
2459
- if expression.args.get("cast_to_granularity_type") and timestamp.type:
2460
- return self.sql(exp.Cast(this=result, to=timestamp.type))
+ if expression.args.get("cast_to_granularity_type") and date.type:
+ return self.sql(exp.Cast(this=result, to=date.type))
2461
return result
2462
2463
def timestamptrunc_sql(self, expression: exp.TimestampTrunc) -> str:
0 commit comments