summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/postgres.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-08-14 10:12:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-08-14 10:12:13 +0000
commitcdffd0b29d5b072639bb02118d6828f4d1b76099 (patch)
tree57ec0b75c40e40a33060b63599bbba6f0af27ae8 /sqlglot/dialects/postgres.py
parentAdding upstream version 17.11.0. (diff)
downloadsqlglot-upstream/17.12.0.tar.xz
sqlglot-upstream/17.12.0.zip
Adding upstream version 17.12.0.upstream/17.12.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/dialects/postgres.py')
-rw-r--r--sqlglot/dialects/postgres.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/sqlglot/dialects/postgres.py b/sqlglot/dialects/postgres.py
index ca44b70..73ca4e5 100644
--- a/sqlglot/dialects/postgres.py
+++ b/sqlglot/dialects/postgres.py
@@ -16,6 +16,7 @@ from sqlglot.dialects.dialect import (
no_pivot_sql,
no_tablesample_sql,
no_trycast_sql,
+ parse_timestamp_trunc,
rename_func,
simplify_literal,
str_position_sql,
@@ -286,9 +287,7 @@ class Postgres(Dialect):
FUNCTIONS = {
**parser.Parser.FUNCTIONS,
- "DATE_TRUNC": lambda args: exp.TimestampTrunc(
- this=seq_get(args, 1), unit=seq_get(args, 0)
- ),
+ "DATE_TRUNC": parse_timestamp_trunc,
"GENERATE_SERIES": _generate_series,
"NOW": exp.CurrentTimestamp.from_arg_list,
"TO_CHAR": format_time_lambda(exp.TimeToStr, "postgres"),