User tests: Successful: Unsuccessful:
Pull Request for Issue # .
This PR fixes all datetime columns of the #__redirect_links
database table so there will not be any Invalid value '0000-00-00 00:00:00' for datetime
error anymore on MySQL 5.7 or later when strict mode is enabled.
In opposite to PR #26372 , this PR here does not depend on PR #26295 , because this one here does not have anything to change in table #__ucm_content
.
Currently the #__redirect_links
table only contains 2 datetime columns, created_date
and modified_date
. Those will be handled like the same columns of the #__banners
table in PR #26372 , i.e. they will get no default value.
The default value is only used when inserting new records without specifying values for that particular column. Not having a default will enforce to insert new records with values for these columns being provided and throw an SQL error if some of these values is not specified, i.e. such errors will not be hidden anymore.
Old data will be updated as little as possible. The created_date
column will be not touched at all. We can assume that for core components there is no data with values '0000-00-00 00:00:00' on MySQL or '1970-01-01 00:00:00' on PostgreSQL, and data created by 3rd party components should not be modified. The modified_date
column will be set to the value of the created_date
column only on MySQL if it has value '0000-00-00 00:00:00'. Our PHP already sets the modified time to the created time when saving new records, i.e. modified = created means never modified. On PosgreSQL we do not need to update the modified column because there is no invalid datetime value '0000-00-00 00:00:00' problem.
Testers please report back the database kind (MySQL or PostgreSQL) on which you have tested.
If you have both MySQL and PostgreSQL, please test on both if possible.
Test 1: New installation
configuration.php
and delete all Joomla database tables in PhpMyAdmin or PhpPgAdmin (depending on your database type).datetime
/timestamp without timezone
columns.Result: See section "Expected result" below.
Test 2: Update sql script
installation/sql/mysql/joomla.sql
into the SQL command window but don't execute the commands yet:SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
This switches off strict mode to the SQL will run on MySQL 5.7 or later.
administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-09-23.sql
or administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-09-23.sql
(depending on your database type) into the SQL command window, in case of MySQL below the previously pasted commands, but don't execute the commands yet.#__
by your database prefix in the SQL statements pasted before in the SQL input window.datetime
/timestamp without timezone
columns.Result: See section "Expected result" below.
The Redirect component works as well as before. In database there are no columns of type datetime having value '0000-00-00 00:00:00' in a MySQL database, and there is no invalid default value anymore in MySQL >= 5.7 with strict mode on in that kind of database.
The Redirect component works. In a MySQL database there might be columns of type datetime having value '0000-00-00 00:00:00', and the default value of these database columns is invalid in MySQL >= 5.7 with strict mode on.
Maybe core developer docs and extension developer docs should be updated to encourage them not to use '0000-00-00 00:00:00' on MySQL anymore but use real NULL and not abuse '1970-01-01 00:00:00' on PostgreSQL as a speudo null date anymore and use real NULL values also there.
Status | New | ⇒ | Pending |
Category | ⇒ | SQL Administration com_admin Postgresql com_redirect Installation |
Labels |
Added:
?
|
Title |
|
@wilsonge I thought we don't do this for PostgreSQL, only for MySQL, that's why I haven't done that also in my other PR's for PostgreSQL. See e.g. here for banners, also no update for modified on pg: https://github.com/joomla/joomla-cms/pull/26372/files#diff-c4bcedf439207fb5236cc01598c81636.
played for a while ....nothing strange happened (beside some strange things like you need to spent sometimes to discover where the link is ...not in the left menu.... and some other glitches but unrelated to this PR)
I have tested this item
on postgresql 11.5
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 | ⇒ | 2019-10-03 15:17:19 |
Closed_By | ⇒ | wilsonge | |
Labels |
Added:
?
|
Thanks!
Ready for review and test.
@wilsonge Please review.