Open bbkr opened 5 years ago
We were his by this issue in quite a few tables (over 7500) in our databases. And it was good excuse to finally clean up legacy "empty date" and convert those to proper NULLs.
So my vote here is to NOT support legacy dates in any form (forcing users to be more strict is always a good thing) but I think it should be at least mentioned as special case in exceptions section.
MySQL (up to 5.6) supports
0000-00-00 00:00:00
to express "empty date". In MySQL 5.7+ this can be controlled via NO_ZERO_DATE flags enabled by default.Currently legacy timestamps are not supported:
I'm not sure how to handle those. Assume that
0000-00-00 00:00:00
is in factNULL
? But then MySQL has another case - NO_ZERO_IN_DATE - which accepts2019-00-00 00:00:00
as "valid" date when disabled. So stepping into DateTime exception does not mean we always haveNULL
.Maybe Failure should be returned and original string value should be passed to user as part of Failure message? Currently user gets OutOfRange exception:
Or maybe this should not be supported at all, so user is forced to convert to valid value on SELECT level and document this behavior?