Details
-
Improvement
-
Resolution: Fixed
-
Major
-
4.6.0
Description
The format argument of the date/time functions should:
- accept generic format strings such as "yyyy-mm-dd" or "hh:mm:ss" etc. Currently it only accepts numeric format string with valid values for hour/min/sec. Invalid values, or generic templated string such as "hh:mm:ss" is silently ignored and full date/time string is returned.
- error cases for valid args should be properly defined and checked, and should return appropriate errors, instead of silently ignoring invalid formats.
For example:
1) this works as expected (as numbered format strings with valid values for hr/min/sec)
SELECT clock_utc("23:56:00");
{
"$1": "06:02:23.785"
}
2) this doesn't work as expected (as format string is generic text).
SELECT clock_utc("hh:mm:ss");
{
"$1": "2017-01-31T06:01:14.422Z"
}
3) this doesn't work as expected (as format string has invalid hour value 25).
SELECT clock_utc("25:56:00");
{
"$1": "2017-01-31T06:02:33.131Z"
}
Similar behavior is observed with CLOCK_STR/CLOCK_LOCAL([fmt]) also . You may want to check other functions that accept format as argument.
Attachments
Issue Links
- links to