#49344 closed enhancement (fixed)
Make tests running with MySQL 8.0
Reported by: | kaggdesign | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.4 | Priority: | normal |
Severity: | normal | Version: | 5.4 |
Component: | Database | Keywords: | has-patch |
Focuses: | Cc: |
Description
3 tests are failing with MySQL 8.0 due to deprecated modes and use of spacial keys.
Attached is the patch which works as with MySQL 5.7, so with MySQL 8.0.
Attachments (2)
Change History (10)
#2
@
5 years ago
- Milestone changed from Awaiting Review to 5.4
- Owner set to SergeyBiryukov
- Status changed from new to reviewing
#3
follow-up:
↓ 5
@
5 years ago
Thanks for the patch!
Some history on the affected tests, for reference: [27072] / #26847, [30704], [37574] / #36948.
- The failure in
test_set_sql_mode()
(also reported in #44586) is caused byNO_AUTO_CREATE_USER
, which is indeed no longer supported as of MySQL 8.0.11. The query results in an error:SET SESSION sql_mode='IGNORE_SPACE,NO_AUTO_CREATE_USER' #1231 - Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER'
Replacing it withNO_AUTO_VALUE_ON_ZERO
, which is available on both MySQL 5.7 and 8.0, works as expected. ReplacingONLY_FULL_GROUP_BY
withSTRICT_TRANS_TABLES
, however, seems unnecessary in my testing, sinceONLY_FULL_GROUP_BY
is also available on both MySQL 5.7 and 8.0.
- The failure in
test_spatial_indices()
(also reported in #44384) is caused by changing theGeometryCollection
data type name toGeomCollection
in MySQL 8.0.11, with the latter being the preferred name.
AddingSRID 0
did not fix the issue in my testing. Checking the database version and changing the data type accordingly in 49344.diff did the trick.
- The above two changes should be enough to run the tests on MySQL 8.0.16. On MySQL 8.0.19, however, I get more failures in
tests/dbdelta.php
(25 in total). They all look similar to this:2) Tests_dbDelta::test_column_type_change Failed asserting that two arrays are equal. --- Expected +++ Actual @@ @@ Array ( - 'wptests_dbdelta_test.id' => 'Changed type of wptests_dbdelta_test.id from bigint(20) to int(11)' + 'wptests_dbdelta_test.id' => 'Changed type of wptests_dbdelta_test.id from bigint to int(11)' ) tests/phpunit/tests/dbdelta.php:151
This is due to MySQL 8.0.17+ no longer supporting the display width attribute for integer data types:
As of MySQL 8.0.17, the ZEROFILL attribute is deprecated for numeric data types, as is the display width attribute for integer data types. Support for ZEROFILL and display widths for integer data types will be removed in a future MySQL version. Consider using an alternative means of producing the effect of these attributes.
bigint(20)
becomes justbigint
. 49344.2.diff accounts for that as well.
- With the above issues resolved, there's still one failure on MySQL 8.0.17+:
1) Tests_dbDelta::test_wp_get_db_schema_does_no_alter_queries_on_existing_install Failed asserting that an array is empty. tests/phpunit/tests/dbdelta.php:693
This is caused by the samebigint(20)
/bigint
discrepancy coming fromwp_get_db_schema()
. It should probably be explored in a new ticket, since it would likely require changes not just to the tests, but also towp_get_db_schema()
and/ordbDelta()
.
#5
in reply to:
↑ 3
@
5 years ago
Replying to SergeyBiryukov:
With the above issues resolved, there's still one failure on MySQL 8.0.17+:
1) Tests_dbDelta::test_wp_get_db_schema_does_no_alter_queries_on_existing_install Failed asserting that an array is empty. tests/phpunit/tests/dbdelta.php:693This is caused by the same
bigint(20)
/bigint
discrepancy coming fromwp_get_db_schema()
. It should probably be explored in a new ticket, since it would likely require changes not just to the tests, but also towp_get_db_schema()
and/ordbDelta()
.
Created #49364 to address this.
Related: #38032, #44586, #47280, #48377, #44384.