No Code Attached Yet
avatar carlitorweb
carlitorweb
3 Nov 2022

In one of my sites, a error 500 show up when the update reached to 90.2%. Checking the joomla_update.php log file, stop in this follow line:

UPDATE #__history AS h INNER JOIN #__content_types AS c ON h.ucm_type_id = c.type_id SET h.item_id = CONCAT(c.type_alias, '.', h.item_id) /** CAN FAIL **/;

Fixing this line to:

UPDATE `editora_history` AS `h` INNER JOIN `editora_content_types` AS `c` ON h.ucm_type_id = c.type_id SET h.item_id = CONCAT(c.type_alias, '.', h.item_id) /** CAN FAIL **/;

I was able to fix this problem. But then, running the next line, another error show up:
Error de SQL (1067): Invalid default value for 'save_date'

For fix this, i needed change the order of the sentences, from this:

ALTER TABLE `#__history` DROP COLUMN `ucm_type_id` /** CAN FAIL **/;
ALTER TABLE `#__history` MODIFY `save_date` datetime NOT NULL;

to this:

ALTER TABLE `#__history` MODIFY `save_date` datetime NOT NULL;
ALTER TABLE `#__history` DROP COLUMN `ucm_type_id` /** CAN FAIL **/;

After this, the update work okay.

System information (as much as possible)

PHP - 8.1.7
MySQL - 5.7.33
Apache/2.4.47 (Win64)

avatar carlitorweb carlitorweb - open - 3 Nov 2022
avatar joomla-cms-bot joomla-cms-bot - change - 3 Nov 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 3 Nov 2022
avatar alikon
alikon - comment - 3 Nov 2022

iirc the update path should be from 3.9.x to 3.10.x and only then to 4.x

from 3.9.x to 4 shouln't be allowed

avatar richard67
richard67 - comment - 3 Nov 2022

I think that was just a typo and he meant 3.10.11.

avatar richard67
richard67 - comment - 3 Nov 2022

In one of my sites, a error 500 show up when the update reached to 90.2%. Checking the joomla_update.php log file, stop in this follow line:

UPDATE #__history AS h INNER JOIN #__content_types AS c ON h.ucm_type_id = c.type_id SET h.item_id = CONCAT(c.type_alias, '.', h.item_id) /** CAN FAIL **/;

Fixing this line to:

UPDATE `editora_history` AS `h` INNER JOIN `editora_content_types` AS `c` ON h.ucm_type_id = c.type_id SET h.item_id = CONCAT(c.type_alias, '.', h.item_id) /** CAN FAIL **/;

I was able to fix this problem.

That doesn’t make sense to me because the only difference I can see between the logged query and your modifications is the table name prefix not being replaced in the log, which is normal for that log, and the names quoting of the table aliases, which should also not make any difference.

Are you really sure that an SQL error was the reason for the 500, i.e. has there been some sql error shown somewhere, or is this just your assumption and the 500 might also have other reasons?

But then, running the next line, another error show up: Error de SQL (1067): Invalid default value for 'save_date'

For fix this, i needed change the order of the sentences, from this:

ALTER TABLE `#__history` DROP COLUMN `ucm_type_id` /** CAN FAIL **/;
ALTER TABLE `#__history` MODIFY `save_date` datetime NOT NULL;

to this:

ALTER TABLE `#__history` MODIFY `save_date` datetime NOT NULL;
ALTER TABLE `#__history` DROP COLUMN `ucm_type_id` /** CAN FAIL **/;

That happens only in PhpMyAdmin when strict mode is on. When the updated runs that query, that does not happen because it switches of some parts of strict mode during the update. So that is also not really the issue.

avatar carlitorweb carlitorweb - change - 3 Nov 2022
Title
Error 500 updating from J3.9.11 to J4.2.4. Wrong SQL syntax
Error 500 updating from J3.10.11 to J4.2.4. Wrong SQL syntax
avatar carlitorweb carlitorweb - edited - 3 Nov 2022
avatar carlitorweb
carlitorweb - comment - 3 Nov 2022

iirc the update path should be from 3.9.x to 3.10.x and only then to 4.x

from 3.9.x to 4 shouln't be allowed

Sorry, I meant 3.10

avatar carlitorweb
carlitorweb - comment - 3 Nov 2022

In one of my sites, a error 500 show up when the update reached to 90.2%. Checking the joomla_update.php log file, stop in this follow line:

UPDATE #__history AS h INNER JOIN #__content_types AS c ON h.ucm_type_id = c.type_id SET h.item_id = CONCAT(c.type_alias, '.', h.item_id) /** CAN FAIL **/;

Fixing this line to:

UPDATE `editora_history` AS `h` INNER JOIN `editora_content_types` AS `c` ON h.ucm_type_id = c.type_id SET h.item_id = CONCAT(c.type_alias, '.', h.item_id) /** CAN FAIL **/;

I was able to fix this problem.

That doesn’t make sense to me because the only difference I can see between the logged query and your modifications is the table name prefix not being replaced in the log, which is normal for that log, and the names quoting of the table aliases, which should also not make any difference.

Are you really sure that an SQL error was the reason for the 500, i.e. has there been some sql error shown somewhere, or is this just your assumption and the 500 might also have other reasons?

But then, running the next line, another error show up: Error de SQL (1067): Invalid default value for 'save_date'
For fix this, i needed change the order of the sentences, from this:

ALTER TABLE `#__history` DROP COLUMN `ucm_type_id` /** CAN FAIL **/;
ALTER TABLE `#__history` MODIFY `save_date` datetime NOT NULL;

to this:

ALTER TABLE `#__history` MODIFY `save_date` datetime NOT NULL;
ALTER TABLE `#__history` DROP COLUMN `ucm_type_id` /** CAN FAIL **/;

That happens only in PhpMyAdmin when strict mode is on. When the updated runs that query, that does not happen because it switches of some parts of strict mode during the update. So that is also not really the issue.

Okay. I will check, just wanted report how happen this, and what made the update work

avatar richard67
richard67 - comment - 3 Nov 2022

Well if there was a syntax error in our update SQL, all people would have that problem when updating from 3.10, and that's definitely not the case.

avatar carlitorweb carlitorweb - change - 4 Nov 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-11-04 10:28:49
Closed_By carlitorweb
avatar carlitorweb carlitorweb - close - 4 Nov 2022
avatar carlitorweb
carlitorweb - comment - 4 Nov 2022

Well if there was a syntax error in our update SQL, all people would have that problem when updating from 3.10, and that's definitely not the case.

That is true.

Add a Comment

Login with GitHub to post a comment