mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
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 in5b3c595355
orbcc704b524
. 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
This commit is contained in:
@@ -3578,6 +3578,13 @@ DecodeInterval(char **field, int *ftype, int nf, int range,
|
||||
break;
|
||||
|
||||
case AGO:
|
||||
|
||||
/*
|
||||
* "ago" is only allowed to appear at the end of the
|
||||
* interval.
|
||||
*/
|
||||
if (i != nf - 1)
|
||||
return DTERR_BAD_FORMAT;
|
||||
is_before = true;
|
||||
type = uval;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user