? ? Pending

User tests: Successful: Unsuccessful:

avatar richard67
richard67
28 Mar 2020

Pull Request for Issue #28367 .

Summary of Changes

This Pull Request (PR) changes the database schema checker for MySQL so that any display width is ignored for integer (int or tinyint) columns when checking these columns.

The reason for this is that beginning with MySQL 8.0.19, the type in a SHOW COLUMNS statement doesn't include anymore the display width if the database has been created in that version, while on previous versions it is included. E.g. on MySQL 5.7 or 8.0.18 the type value is "int(11)" or "int(10) unsigned" or "tinyint(3)" while on mySQL 8.0.19 it is just "int" or "int unsigned" or "tinyint".

The display width doesn't have any impact on value range or storage size for an integer column, it only determines how a value would be left-padded with zeros if that would be done, but this padding is deprecated anyway. See https://dev.mysql.com/doc/refman/8.0/en/numeric-type-attributes.html for details.

Testing Instructions

Requirements

Have a MySQL database with version 8.0.19 and another one with an older version, e.g. 5.7 or 8.0.18 or a MariaDB. If you don't have both but only one of these 2, report back with which version you have tested. At the end it needs each 2 tests for the following cases:

  • MySQL 8.0.19: Test that this PR fixes the issue.
  • MySQL lower than 8.0.19 or MariaDB: Test that this PR doesn't create a new issue.

Instructions

Install a clean staging without the patch of this PR applied on MySQL 8.0.19, using a database which you have created on that database version or creating a new one during installation.

Then go to the database checker.

Result: You see errors about columns of type int(11) and int(10) and tinyint(3) and similar. See section "Actual result" below.

Now apply the patch of this PR and go again to the database checker or reload the page if still there.

Result: No errors are shown, see section "Expected result" below.

Now delete configuration.php and install the staging with the patch of this PR applied on a MySQL version prior to 8.0.19, e.g. 5.7 or 8.0.18.

Then go to the database checker.

Result: With this PR applied it works as before for MySQL prior to 8.0.19, i.e. there are no database errors after a clean install.

Expected result

All database table structures are up to date.

No problems were found.

Actual result

j3-error-database-checker-int-display-width

Using the "Fix" button does not fix these false errors.

Documentation Changes Required

None.

Additional information

I found following statement here https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-19.html in section "Deprecation and Removal Notes":

For DESCRIBE statements and INFORMATION_SCHEMA queries, output is unaffected for objects created in previous MySQL 8.0 versions because information already stored in the data dictionary remains unchanged. This exception does not apply for upgrades from MySQL 5.7 to 8.0, for which all data dictionary information is re-created such that data type definitions do not include display width.

I.e. if you have updated e.g. an 8.0.18 to an 8.0.19, previously present databases still will show the display width in their integer data types, and so you can't reproduce the issue. But as soon as using a newly created database, you can reproduce it.

avatar richard67 richard67 - open - 28 Mar 2020
avatar richard67 richard67 - change - 28 Mar 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 28 Mar 2020
Category Libraries
avatar richard67 richard67 - change - 28 Mar 2020
Labels Added: ?
avatar richard67
richard67 - comment - 28 Mar 2020

@alikon @brianteeman Could you test this one, too? Is same as #28370 for J4, but here for staging, and in opposite to the other one I had to handle tinyint columns here, soo, see the screenshot in the description.

avatar richard67 richard67 - change - 28 Mar 2020
The description was changed
avatar richard67 richard67 - edited - 28 Mar 2020
avatar richard67 richard67 - change - 28 Mar 2020
The description was changed
avatar richard67 richard67 - edited - 28 Mar 2020
avatar richard67 richard67 - change - 28 Mar 2020
The description was changed
avatar richard67 richard67 - edited - 28 Mar 2020
avatar richard67 richard67 - change - 29 Mar 2020
The description was changed
avatar richard67 richard67 - edited - 29 Mar 2020
avatar richard67 richard67 - change - 29 Mar 2020
The description was changed
avatar richard67 richard67 - edited - 29 Mar 2020
avatar richard67 richard67 - change - 29 Mar 2020
The description was changed
avatar richard67 richard67 - edited - 29 Mar 2020
avatar richard67 richard67 - change - 29 Mar 2020
The description was changed
avatar richard67 richard67 - edited - 29 Mar 2020
avatar alikon
alikon - comment - 29 Mar 2020

I have tested this item successfully on 19f3009

tested only on mysql 8.0.19-0ubuntu0.19.10.3


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/28501.

avatar alikon alikon - test_item - 29 Mar 2020 - Tested successfully
avatar richard67 richard67 - change - 2 Apr 2020
The description was changed
avatar richard67 richard67 - edited - 2 Apr 2020
avatar richard67
richard67 - comment - 2 Apr 2020

I've just adjusted the testing instructions so it doesn't need testers having both kinds of databases MySQL 8.0.19 to check that the PR solves the issue, and MySQL older than 8.0.19 or MariaDB to check that for these the PR doesn't create a new issue.

Testers please report back with which version you have tested.

At the end it will need 2 tests of each kind of the following 2 kinds:

  • MySQL 8.0.19: Test that this PR fixes the issue.
  • MySQL lower than 8.0.19 or MariaDB: Test that this PR doesn't create a new issue.
avatar Quy
Quy - comment - 2 Apr 2020

I have tested this item successfully on 19f3009

MySQL 8.0.18 & 8.0.19
MariaDB 10.4.10
Windows 10 WampServer


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/28501.

avatar Quy Quy - test_item - 2 Apr 2020 - Tested successfully
avatar alikon alikon - change - 3 Apr 2020
Status Pending Ready to Commit
avatar alikon
alikon - comment - 3 Apr 2020

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/28501.

avatar HLeithner HLeithner - change - 4 Apr 2020
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-04-04 08:55:46
Closed_By HLeithner
Labels Added: ?
avatar HLeithner
HLeithner - comment - 4 Apr 2020

Thanks

avatar richard67
richard67 - comment - 7 Mar 2021

While working on issue #32542 I've noticed that this PR here should have handled also the other integer data types and not only int and tinyint. The reason why I haven't done that is that for the other types we do not have any relevant update SQL scripts to be checked by the schema checker, and so we never ran into the issue fixed by this PR. Am preparing a PR now.

Add a Comment

Login with GitHub to post a comment