提交 064eb5c3 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Reject non-standard DATE 'yymmdd' (with 2-digit year) for now

上级 5e308433
...@@ -364,7 +364,8 @@ public class DateTimeUtils { ...@@ -364,7 +364,8 @@ public class DateTimeUtils {
// Additional [+|-]yyyyMMdd format for compatibility // Additional [+|-]yyyyMMdd format for compatibility
mEnd = dStart = end - 2; mEnd = dStart = end - 2;
yEnd = mStart = mEnd - 2; yEnd = mStart = mEnd - 2;
if (yEnd <= start) { // Accept only 3 or more digits in year for now
if (yEnd < start + 3) {
throw new IllegalArgumentException(s); throw new IllegalArgumentException(s);
} }
} }
......
...@@ -24,3 +24,10 @@ SELECT DATE '20000102'; ...@@ -24,3 +24,10 @@ SELECT DATE '20000102';
SELECT DATE '-1000102'; SELECT DATE '-1000102';
>> -100-01-02 >> -100-01-02
SELECT DATE '3001231';
>> 0300-12-31
-- PostgreSQL returns 2020-12-31
SELECT DATE '201231';
> exception INVALID_DATETIME_CONSTANT_2
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论