Tighten handling of "ago" in interval values
commit165d581f146b09543b832513ee00fead132ba6b1
authorMichael Paquier <michael@paquier.xyz>
Mon, 28 Aug 2023 04:49:55 +0000 (28 13:49 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 28 Aug 2023 04:49:55 +0000 (28 13:49 +0900)
treea43e1e15c121ed652ffc3969c9d935bc02698f16
parent9a0ddc39c64b8dddddf4f58eb137f53bf94eb098
Tighten handling of "ago" in interval values

This commit Restrict the unit "ago" to only appear at the end of the
interval.  According to the documentation, a direction can only be
defined at the end of an interval, but it was possible to define it in
the middle of the string or define it multiple times.

In spirit, this is similar to the error handling improvements done in
5b3c5953553b or bcc704b524904.

Author: Joseph Koshakow
Reviewed-by: Jacob Champion, Gurjeet Singh, Reid Thompson
Discussion: https://postgr.es/m/CAAvxfHd-yNO+XYnUxL=GaNZ1n+eE0V-oE0+-cC1jdjdU0KS3iw@mail.gmail.com
src/backend/utils/adt/datetime.c
src/test/regress/expected/interval.out
src/test/regress/sql/interval.sql