I’ve been thinking a lot about invalid and zero temporal values
and how to detect them with MySQL date and time functions because
mk-table-checksum has to handle “everything” correctly and
efficiently. The requirements are complex because we have to take
into account what MySQL allows to be stored verses what it allows
to be used in certain operations and functions, how it sorts a
mix of real and invalid temporal values for MIN()
and MAX()
, how to detect a temporal value as
equivalent to zero, and how different MySQL versions might affect
any of the aforementioned.
At base, the four guiding requirements are:
- Detect and discard invalid time, date, and datetime values
- Detect zero-equivalent temporal values
- Do #1 and #2 using only MySQL functions
- Work in MySQL 4.0 …