From: | PG Doc comments form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-docs(at)lists(dot)postgresql(dot)org |
Cc: | caetanosauer(at)gmail(dot)com |
Subject: | Argument 'week' not supported in date_trunc function with intervals |
Date: | 2020-01-03 12:31:27 |
Message-ID: | 157805468778.1149.10815835689820301977@wrigleys.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/12/functions-datetime.html
Description:
In the documentation of the date_trunc function (9.9.2), the first argument
(field) cannot be 'week' if the second argument (source) is an interval:
csauer=# SELECT DATE_TRUNC('week', INTERVAL '7 days');
ERROR: interval units "week" not supported because months usually have
fractional weeks
csauer=# SELECT DATE_TRUNC('week', INTERVAL '1 week');
ERROR: interval units "week" not supported because months usually have
fractional weeks
The documentation should state that explicitly.
I also think the error message could be improved, because in the cases above
there are no months involved and the result should be 1.
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2020-01-03 13:35:20 | Re: doc: Add anchors in create_table.sgml |
Previous Message | Magnus Hagander | 2020-01-03 10:00:36 | Re: Link to "Upgrading a PostgreSQL Cluster" in Release Notes |