mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-03-13 19:57:53 +08:00
On second thought, explain why date_trunc("week") on interval values is
not supported in the error message, rather than the docs.
This commit is contained in:
parent
74f4881d7c
commit
083b9133aa
@ -7050,11 +7050,6 @@ date_trunc('<replaceable>field</replaceable>', <replaceable>source</replaceable>
|
||||
</simplelist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>week</literal> is not supported for <type>interval</>
|
||||
values because months usually have fractional weeks.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Examples:
|
||||
<screen>
|
||||
|
@ -3710,10 +3710,17 @@ interval_trunc(PG_FUNCTION_ARGS)
|
||||
break;
|
||||
|
||||
default:
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("interval units \"%s\" not supported",
|
||||
lowunits)));
|
||||
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,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("interval units \"%s\" not supported",
|
||||
lowunits)));
|
||||
}
|
||||
|
||||
if (tm2interval(tm, fsec, result) != 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user