User tests: Successful: Unsuccessful:
Pull Request for Issue #32542 (part).
This pull request (PR) removes display width modifiers for integer data types in DDL statements in all SQL scripts for installation and updates and from PHP code (small piece of code in the extension installer's database model to create the utf8 conversion table when updating very old installations) for MySQL and MariaDB databases.
It is only relevant for MySQL and MariaDB databases, i.e. not for PostgreSQL or MS SQL Server.
These reason for these changes is that MySQL have deprecated the display width modifier for integer data type columns beginning with server version 8.0.17, see here in their documentation, which causes warnings on database servers of these versions when running the relevant SQL statements e.g. in phpMyAdmin, and as MySQL don't use semantic versioning (at least not in x.0 versions), they might stop to support it with any future version, and so these statement will cause SQL errors, and Joomla installation or updates will fail.
In opposite to this, MariaDB still continue to use and support the display width modifier for integer data type columns.
That means we have to kinds of database servers regarding these modifiers:
As explained in issue #32542, MySQL docs and MariaDB docs, the display width modifier for integer data type has no impact on storage size or value range. It is only relevant when using the zerofill
attribute on such a database column, what the CMS core never did.
In my opinion there are only 2 possible reasons why the attribute has been used by the CMS core:
float(10)
, real(10)
, double(10)
, where the 10
is the precision and not a display width.The solution provided by this PR here in order to be safe from future drop of support for display width modifiers by MySQL is not so use the display width modifier anymore in any SQL statement.
For DDL statements like e.g. CREATE TABLE
or ALTER TABLE ... MODIFY ...
, the result is different for the 2 types of databases when not using the display width modifier:
You need a MySQL or MariaDB database.
Testers please report back which of the following 2 kinds of databases you have used for the test:
If you have both scenarios available, please test both.
This test is optional and can be only executed when having a MySQL database server of version 8.0.17 or later.
If you don't have that kind of MySQL database server, skip this test.
During my tests I wasn't able to configure my MySQL 8.0.20 server in a way that the deprecation warnings for the display widths could be shown in the server log file, and you can believe me I've tried a lot of things.
Furthermore, it appeared that when importing an SQL script using display widths for integers in DDL into phpMyAdmin, there are also no warnings shown.
So if you want to see the issue you have to do as follows:
In phpMyadmin, select a database.
Copy the first CREATE TABLE
statements for the #__assets
table (or any other which contains display widths) from file installation/sql/mysql/joomla.sql of the staging branch (i.e. not from this PR) into the SQL command window.
Hint: You can use also several statements at once, but you should not use the complete content of the SQL script since in this case phpMyAdmin (or the server?) seem to suppress the warnings due to their high count.
Execute the SQL in the SQL command window (no need to replace the table name prefix before).
Result: You get warnings Warning: #1681 Integer display width is deprecated and will be removed in a future release.
.
Remove the table created in the previous step.
Repeat steps 2 and 3 but using a statement from the installation/sql/mysql/joomla.sql file of this PR.
Result: Don't get the warnings from step 3.
The automated system tests make already sure that this PR doesn't produce an SQL error in the installation SQL, but it doesn't check if we have database problems in the schema checker after that or not, therefore this test.
Make again a new installation with the patch of this PR applied.
Login to backend.
Go to "Extensions -> Manage -> Database" and verify that no database problems are shown.
Result: No database problems found.
Result:
Unfortunately the packages built by drone are only for updating previous 3.9.x versions, beginning with 3.9.0, but not older.
This means that the changes on the update SQL scripts can't be tested with such an update package.
Therefore I've build a modified update package for updating older versions.
This can be downloaded from here and then used for the test with "Upload & Update": https://test5.richard-fath.de/Joomla_3.9.26-dev+pr.32606-Development-Update_Package.zip.
The starting point is a clean Joomla installation with a version older than 3.9.0 (the older, the better, as long as possible on your testing environment).
Login to backend.
Make sure to see any database errors or warnings by switching on "Debug System" and setting "Error Reporting" to "Maximum" or "Development" in Global Configuration.
Update to current staging + the patch of this PR applied by using the update package mentioned above, using the "Upload & Update" method.
While the update runs, verify that no SQL errors or warnings are shown in backend or in your MySQL or MariaDB server's log file or in the PHP error log.
Go to "Extensions -> Manage -> Database" and verify that no database problems are shown.
Result: No database problems found.
Result:
SQL scripts and at one place the installer's database model use the unnecessary and for MySQL versions 8.0.17 or later deprecated display width modifier for integer data types.
No display width modifier is used for integer data types at any place in SQL or other code except of unit tests coming with the framework package.
After a new installation on MySQL database servers with versions lower than 8.0.17 or any version of MariaDB servers, database columns with integer data types have the default display widths for the particular data type. On MySQL database servers with versions 8.0.17 or newer, such database columns have no display widths.
When updating from 3.8.x or older, display widths haven't been changed for database columns which existed already before the update and haven't been modified by the update for other changes than display widths. For newly created or modified columns, the above statement for new installations applies.
None.
@zero-24 @wilsonge This PR needs to be merged up into 3.10-dev sooner of later after it has been merged into staging, so that with PR #32607 the 3.10-dev branch will be complete regarding the issue fixed here. But this PR here does not need to be merged up into 4.0-dev, i.e. any conflicts resulting in an upmerge in 4.0-dev done after my PR #32608 has been merged into the 4.0-dev branch could be solved by accepting the 4.0-dev version of the particular conflict.
Status | New | ⇒ | Pending |
Category | ⇒ | SQL Administration com_admin Installation |
Labels |
Added:
?
|
Category | SQL Administration com_admin Installation | ⇒ | SQL Administration com_admin com_banners com_contact |
Title |
|
Category | SQL Administration com_admin com_banners com_contact | ⇒ | Administration com_admin com_banners com_contact SQL Unit Tests |
Category | SQL Administration com_admin com_banners com_contact Unit Tests | ⇒ | SQL Administration com_admin com_banners com_contact |
I've also simplified testing instructions. Ready for testing.
after update there were the following differences in database (should have no consequences)
@chmst These changes are right, because when updating a 3.9.25, the table columns are not touched and so keep their display widths from before the update, while when updating the 3.8 with my modified package, they are created with the default display widths. They show that the PR works as expected.
I have tested this item
See comment below concerning my testing environment.
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-03-27 14:53:58 |
Closed_By | ⇒ | rdeutz | |
Labels |
Added:
?
|
Thanks for testing and merge.
I've reverted the changes on database unit tests. These were partly made already in the framework.