Commit 083b9133 authored by Bruce Momjian's avatar Bruce Momjian

On second thought, explain why date_trunc("week") on interval values is

not supported in the error message, rather than the docs.
parent 74f4881d
...@@ -7050,11 +7050,6 @@ date_trunc('<replaceable>field</replaceable>', <replaceable>source</replaceable> ...@@ -7050,11 +7050,6 @@ date_trunc('<replaceable>field</replaceable>', <replaceable>source</replaceable>
</simplelist> </simplelist>
</para> </para>
<para>
<literal>week</literal> is not supported for <type>interval</>
values because months usually have fractional weeks.
</para>
<para> <para>
Examples: Examples:
<screen> <screen>
......
...@@ -3710,6 +3710,13 @@ interval_trunc(PG_FUNCTION_ARGS) ...@@ -3710,6 +3710,13 @@ interval_trunc(PG_FUNCTION_ARGS)
break; break;
default: default:
if (val == DTK_WEEK)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("interval units \"%s\" not supported "
"because months usually have fractional weeks",
lowunits)));
else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("interval units \"%s\" not supported", errmsg("interval units \"%s\" not supported",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment