diff options
Diffstat (limited to 'sqlglot/dialects/postgres.py')
-rw-r--r-- | sqlglot/dialects/postgres.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sqlglot/dialects/postgres.py b/sqlglot/dialects/postgres.py index ef100b1..ca44b70 100644 --- a/sqlglot/dialects/postgres.py +++ b/sqlglot/dialects/postgres.py @@ -40,10 +40,12 @@ DATE_DIFF_FACTOR = { def _date_add_sql(kind: str) -> t.Callable[[generator.Generator, exp.DateAdd | exp.DateSub], str]: def func(self: generator.Generator, expression: exp.DateAdd | exp.DateSub) -> str: + expression = expression.copy() + this = self.sql(expression, "this") unit = expression.args.get("unit") - expression = simplify_literal(expression.copy(), copy=False).expression + expression = simplify_literal(expression).expression if not isinstance(expression, exp.Literal): self.unsupported("Cannot add non literal") |