Comment 0 for bug 1942476

Revision history for this message
Paride Legovini (paride) wrote :

The test suite is failing when running against MySQL >= 8.0.24 with:

---------------------------------------------

Failures:

  1) Mysql2::Result row data type mapping should raise an error given an invalid DATETIME
     Failure/Error:
       expect { @client.query("SELECT CAST('1972-00-27 00:00:00' AS DATETIME) as bad_datetime").each }.to \
         raise_error(Mysql2::Error, "Invalid date in field 'bad_datetime': 1972-00-27 00:00:00")

       expected Mysql2::Error with "Invalid date in field 'bad_datetime': 1972-00-27 00:00:00" but nothing was raised
     # ./spec/mysql2/result_spec.rb:321:in `block (3 levels) in <top (required)>'

  2) Mysql2::Statement row data type mapping should raise an error given an invalid DATETIME
     Failure/Error:
       expect { @client.query("SELECT CAST('1972-00-27 00:00:00' AS DATETIME) as bad_datetime").each }.to \
         raise_error(Mysql2::Error, "Invalid date in field 'bad_datetime': 1972-00-27 00:00:00")

       expected Mysql2::Error with "Invalid date in field 'bad_datetime': 1972-00-27 00:00:00" but nothing was raised
     # ./spec/mysql2/statement_spec.rb:478:in `block (3 levels) in <top (required)>'

---------------------------------------------

This is because according to the release notes (https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-24.html):

    Using CAST() on a DATE or DATETIME value in an INSERT statement
    raised a warning for "0000-00-00" and "2000-02-31", but not for
    "2000-01-00" or "2000-00-01". Now a warning is shown in each of
    these cases also.

The statement_spec.rb and result_spec.rb files need to be updated with a bad date that still generates an error, e.g. 2000-01-00.