MDEV-34088 The TIMESTAMP value of '1970-01-01 00:00:00' can be indirectly inserted in strict mode
In strict mode a timestamp(0) column could be directly assigned from another timestamp(N>0) column with the value '1970-01-01 00:00:00.1' (at time zone '+00:00'), or with any other value '1970-01-01 00:00:00.XXXXXX' with non-zero microsecond value XXXXXX. This assignment happened silently without warnings or errors. It worked as follows: - The value {tv_sec=0, tv_usec=100000}, which is '1970-01-01 00:00:00.1' was rounded to {tv_sec=0, tv_usec=0}, which is '1970-01-01 00:00:00.0' - Then {tv_sec=0, tv_usec=0} was silently re-interpreted as zero datetime. After the fix this assignment always raises a warning, which in case of the strict mode is escalated to an error. The problem in this scenario is that '1970-01-01 00:00:00' cannot be stored, because its timeval value {tv_sec=0, tv_usec=0} is reserved for zero datetimes. Thus the warning should be raised no matter if sql_mode allows or disallows zero dates.
Showing
Please register or sign in to comment