summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/postgres.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-10 08:53:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-10 08:53:14 +0000
commitcd37a3bcaced9283c20baa52837c96b524baec54 (patch)
tree101b1c1487aa832a982dd635cd3b00d4d2ea3ae9 /sqlglot/dialects/postgres.py
parentReleasing progress-linux version 18.11.2-1. (diff)
downloadsqlglot-cd37a3bcaced9283c20baa52837c96b524baec54.tar.xz
sqlglot-cd37a3bcaced9283c20baa52837c96b524baec54.zip
Merging upstream version 18.11.6.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/dialects/postgres.py')
-rw-r--r--sqlglot/dialects/postgres.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/sqlglot/dialects/postgres.py b/sqlglot/dialects/postgres.py
index 008727c..c435309 100644
--- a/sqlglot/dialects/postgres.py
+++ b/sqlglot/dialects/postgres.py
@@ -205,7 +205,7 @@ def _remove_target_from_merge(expression: exp.Expression) -> exp.Expression:
for when in expression.expressions:
when.transform(
- lambda node: exp.column(node.name)
+ lambda node: exp.column(node.this)
if isinstance(node, exp.Column) and normalize(node.args.get("table")) in targets
else node,
copy=False,
@@ -439,6 +439,8 @@ class Postgres(Dialect):
exp.TryCast: no_trycast_sql,
exp.TsOrDsToDate: ts_or_ds_to_date_sql("postgres"),
exp.UnixToTime: lambda self, e: f"TO_TIMESTAMP({self.sql(e, 'this')})",
+ exp.VariancePop: rename_func("VAR_POP"),
+ exp.Variance: rename_func("VAR_SAMP"),
exp.Xor: bool_xor_sql,
}