summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/postgres.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-08-14 10:12:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-08-14 10:12:19 +0000
commit3742f86d166160ca3843872ebecb6f30c51f6085 (patch)
tree6d747c3e7082fc2bae56053930813d5625e9b3d8 /sqlglot/dialects/postgres.py
parentReleasing debian version 17.11.0-1. (diff)
downloadsqlglot-3742f86d166160ca3843872ebecb6f30c51f6085.tar.xz
sqlglot-3742f86d166160ca3843872ebecb6f30c51f6085.zip
Merging upstream version 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"),