diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-08-10 09:23:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-08-10 09:23:50 +0000 |
commit | 4cc7d5a6dcda8f275b4156a9a23bbe5380be1b53 (patch) | |
tree | 1084b1a2dd9f2782031b4aa79608db08968a5837 /sqlglot/dialects/postgres.py | |
parent | Releasing debian version 17.9.1-1. (diff) | |
download | sqlglot-4cc7d5a6dcda8f275b4156a9a23bbe5380be1b53.tar.xz sqlglot-4cc7d5a6dcda8f275b4156a9a23bbe5380be1b53.zip |
Merging upstream version 17.11.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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") |