=?UTF-8?B?5q2j5Y2O5ZCV?= <kainwen@xxxxxxxxx> writes: > I test the following SQL in pg15dev (seems same behavior as the > previous version). > select '2020701'::date; > date > ------------ > 0202-07-01 > (1 row) > At the first glance, the result seems quite strange. [ shrug... ] You left out a zero. It's not apparent to me that this answer is wrong. > The question here is: should we throw error for such input? Or what > standard postgres is > using to cast such kind of string? The bar to changing any behavior here is a *lot* higher than you seem to imagine. Having said that, it does appear that we changed this somewhere between 9.3 and 9.4: psql (9.3.25) Type "help" for help. regression=# select '2020701'::date; ERROR: invalid input syntax for type date: "2020701" LINE 1: select '2020701'::date; ^ psql (9.4.26) Type "help" for help. regression=# select '2020701'::date; date ------------ 0202-07-01 (1 row) If you want to pursue this question, you could start by bisecting to find just which commit changed it and why. regards, tom lane