? ?
avatar obuisard
obuisard
27 Mar 2021

Steps to reproduce the issue

Install Joomla 3.10 alpha 5
In config of Joomla! update, set 'update channel' to 'custom URL' and 'custom URL' to 'https://update.joomla.org/core/nightlies/next_major_list.xml'
Go back to Joomla! update and go on with the update (target version being Joomla 4 beta 8-dev)
(Write files directly)

Expected result

Update to Joomla 4

Actual result

The Joomla 4 dashboard opens with error:
The template for this display is not available.
1093 You can't specify target table 'py1ph_template_styles' for update in FROM clause

Files seem updated, but not the database (the template_styles table, for instance, remains unchanged)

System information (as much as possible)

PHP 7.3.11
MySQL 5.7.14
Apache 2.4.41
on Wampserver 3.2.4

Additional comments

I have tried different combinations of 3.10 alpha 5/6-dev, to Joomla 4 beta 8-dev (with custom URL) or through manual download of Joomla 4 beta 8-dev and Joomla 4 beta 7.
All with the same results.

avatar obuisard obuisard - open - 27 Mar 2021
avatar joomla-cms-bot joomla-cms-bot - labeled - 27 Mar 2021
avatar Bond97
Bond97 - comment - 27 Mar 2021

I think, you might try to install Joomla 3.10.0 alpha 6-dev from https://developer.joomla.org/nightly-builds.html

After install set right update server (see comment above) and try to upgrade to Joomla 4.0.0 beta 7.

Recently there is commited new "Pre-update checker" to Joomla 3.10.0. It provide additional information, which extension, component or plugin might be a reason to fail successfull upgrade to J4.

avatar obuisard
obuisard - comment - 27 Mar 2021

Thank you, I will try that ASAP. I missed the URL https://update.joomla.org/core/test/310to4_list.xml


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

avatar zero-24
zero-24 - comment - 27 Mar 2021

Hmm both sould work the only differnce should be that the first update server is with the nighly builds and the seccond to the latest beta. On a quick look it seems there is an issue with something merged into 4.0-dev after the latest beta but that has to be investigated.

avatar obuisard
obuisard - comment - 27 Mar 2021

I am sad to say that using https://update.joomla.org/core/test/310to4_list.xml lead to the same results.


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

avatar zero-24
zero-24 - comment - 30 Mar 2021

Hmm i have just tried to update from 3.10-alpha6-dev to 4.0-beta8 and I can not reproduce the issue here. Can you do so on that versions? Do you have some extensions installed or was that an clean 3.10 install?

avatar obuisard
obuisard - comment - 30 Mar 2021

I have tried several combinations:
from 3.10-alpha5 and 3.10-alpha6-dev (dated March,25) to 4.0-beta7 or 4.0-beta8-dev.
Every single time with no additional extension, just clean installs.


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

avatar obuisard
obuisard - comment - 30 Mar 2021

I have tried once again from todays builds (my hard drive is going to hate me)screen shot 2021-03-30 at 22 04 51.
3.10-alpha6 to 4.0-beta8. First screen once Joomla's update ends.


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

avatar zero-24
zero-24 - comment - 30 Mar 2021

Hmm interesting, i did not got that while doing the same upgrade path. @richard67 do you have an idea what this error could be about?

avatar richard67
richard67 - comment - 30 Mar 2021

Not yet, have to check tomorrow or on weekend when I have more time.

avatar zero-24
zero-24 - comment - 30 Mar 2021

Great thanks!

avatar richard67 richard67 - change - 2 Jun 2021
Labels Added: ?
avatar richard67 richard67 - labeled - 2 Jun 2021
avatar rachelwalraven
rachelwalraven - comment - 19 Jun 2021

I tried with an update from J3.10.0-alpha7 to J4 RC 2 and I got the same message after update.
Template is there and working, so no need for an error it seems.


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

avatar richard67
richard67 - comment - 19 Jun 2021

@rachelwalraven The red error alert about the template not being available is normal when updating from 3.10 to 4 and should go away forever as soon as you navigate around.

The problem here is the SQL error about the target table in the FROM clause thing.

Did you have that too? Or did you only refer to that red alert? If red alert only, then all should be ok with your updated site.

avatar chmst
chmst - comment - 19 Jun 2021

I know that this message means"all is ok with your upate".But why then is it a red alert box? Every user will think "red alert" - omg ... error! What about a less alarming information?

avatar richard67
richard67 - comment - 19 Jun 2021

I know that this message means"all is ok with your upate".But why then is it a red alert box? Every user will think "red alert" - omg ... error! What about a less alarming information?

@chmst That's another thing. Feel free to open an issue for it. Here we are dealing with the SQL error, and that is not related to that alert because the alert also comes if there is no SQL error.

@obuisard Do you still have the log file "administrator/logs/joomla_update.php" from that failed update? If so, which was the last SQL statement logged for the database updates? The SQL statements are truncated to some 140 characters or so in that log, but it should be sufficient for me to see where it broke.

avatar rachelwalraven
rachelwalraven - comment - 21 Jun 2021

I had no other errors.


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

avatar richard67
richard67 - comment - 10 Jul 2021

@obuisard Do you still have the log file "administrator/logs/joomla_update.php" from that failed update? If so, could sou let me know which was the last SQL statement logged for the database updates?

avatar obuisard
obuisard - comment - 10 Jul 2021

@richard67 as a matter of fact, I do! I have not tried 3.9.10 migration to Joomla 4 since then.
Last recorded line was:

2021-03-30T22:02:01+00:00 INFO 127.0.0.1 update Ran query from file 4.0.0-2016-10-02. Query text: INSERT INTO #__extensions (name, type, element, folder, client_id, `.

avatar richard67
richard67 - comment - 10 Jul 2021

@obuisard I see. Well, meanwhile the update SQL scripts have been combined so they are less files. The query which was the last successfully executed one has been moved to here: https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_admin/sql/updates/mysql/4.0.0-2018-03-05.sql#L18-L20 .

So the next one is the one which fails: https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_admin/sql/updates/mysql/4.0.0-2018-03-05.sql#L22-L24 .

I have an idea what the problem could be and will work on a fix when I find time.

avatar ChristineWk
ChristineWk - comment - 10 Jul 2021
avatar richard67
richard67 - comment - 10 Jul 2021

@ChristineWk No, that's not the problem here I think. The problem here is that the insert statement which fails does something which is not allowed on certain versions of MySQL or MariaDB in strict mode: It inserts into a table and has a subquery on the same table. You can find a discussion about the same problem with update queries here: https://stackoverflow.com/questions/4429319/you-cant-specify-target-table-for-update-in-from-clause . What confuses me is that me and other haven't observer this error, but this could be due to different server settings regarding strict mode.

avatar richard67
richard67 - comment - 11 Jul 2021

As I just can see here it might not only depend on the particular MySQL version but also on optimizer settings, see section "Optimizer Notes" here: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-6.html#mysqld-5-7-6-optimizer

For statements such as DELETE or UPDATE that modify tables, using the merge strategy for a derived table that previously was materialized can result in an ER_UPDATE_TABLE_USED error:

mysql> DELETE FROM t1
    -> WHERE id IN (SELECT id
    ->              FROM (SELECT t1.id
    ->                    FROM t1 INNER JOIN t2 USING (id)
    ->                    WHERE t2.status = 0) AS t);
ERROR 1093 (HY000): You can't specify target table 't1'
for update in FROM clause

The error occurs when merging a derived table into the outer query block results in a statement that both selects from and modifies a table. (Materialization does not cause the problem because, in effect, it converts the derived table to a separate table.) To avoid this error, disable the derived_merge flag of the optimizer_switch system variable before executing the statement:

mysql> SET optimizer_switch = 'derived_merge=off';

The derived_merge flag controls whether the optimizer attempts to merge derived tables and view references into the outer query block, assuming that no other rule prevents merging. By default, the flag is on to enable merging. Setting the flag to off prevents merging and avoids the error just described. (Other workarounds include using SELECT DISTINCT or LIMIT in the subquery, although these are not as explicit in their effect on materialization.)

avatar richard67
richard67 - comment - 11 Jul 2021

@obuisard I have a few questions. If I'd ask you to test some possible fixes, would you be available for that? If so, what would be the starting point for an update? Would it be the 3.10 Alpha 5 which you have saved before your unsuccessful update attempt to 4, or would it be the broken partly updated site which you have saved after your unsuccessful update attempt? I ask because the answer to this question decides on which instructions you will get from me for the tests. If we can only use the broken updated site, then I would have to give you some SQL statements to be executed "manually" e.g. in phpMyAdmin.

avatar richard67
richard67 - comment - 11 Jul 2021

@obuisard Next question: Is the server where you have these problems only a local development server? Or is is a real site using a database server provided by the hosting provider? I'm asking because the version 5.7.14 is outdated, and the problem seems to be related to that. In general it seems to be the same problem as in this issue here: #22231 . Do you have the option to update MySQL to 5.7.23 or newer?

Please don't update yet, it's just a question.

avatar obuisard
obuisard - comment - 11 Jul 2021

@richard67 I would like to help! I can scrap my old 3.10 site which I had installed for test purposes only.
I can install the latest alpha or any version you would like me to test.

All my tests are local, on my development server (I am on WampServer 3.2.4). I have not updated MySQL to a newer version just yet, as I am also testing all of my extensions on various sites. I can try with MySQL 5.7.33 for the purpose of testing Joomla 3.10.

Although should the scripts still work for MySQL 5.7.14 since the recommended version of MySQL for Joomla 3 is 5.5.3?

avatar richard67
richard67 - comment - 12 Jul 2021

Although should the scripts still work for MySQL 5.7.14 since the recommended version of MySQL for Joomla 3 is 5.5.3?

As we are talking about updating to J4, the version requirements of J4 have to be used and not those of J3. But that doesn't change that we have to support that version. I just wanted to clarify that you can't update a 3.10 to 4 when using MySQL 5.5.3.

avatar richard67
richard67 - comment - 12 Jul 2021

I've just tried to reproduce the error on an old MySQL 5.6 but it doesn't happen there. I have to check if the issue happens only on particular 5.7 versions like the 5.7.14 reported here or the 5.7.9 reported in issue #22231 .

avatar richard67
richard67 - comment - 12 Jul 2021

@obuisard I could reproduce the issue with the SQL statement in the command line client of a MySQL 5.7.14 and could find a fix.

Pull request is #34763 . It still has draft status because I have to finish instructions.

Could you test if you can update your 3.10 to the update package built for this PR? You can find a link at the bottom of the PR:

2021-07-12_01

This leads to a page where you can find an update package for Upload & Install, or a custom update URL which you can use for Live Update.

2021-07-12_02

Please make a backup of your 3.10 (database and files) or keep your backup so later when this PR has been merged you can update to the right package (RC 4, I hope).

Please report back in that PR if it has worked or not.

Thanks in advance.

avatar richard67
richard67 - comment - 12 Jul 2021

@obuisard P.S.: You might have to click the "Show all checks" at the bottom of the PR link to see the links I have mentioned in my previous comment.

avatar richard67
richard67 - comment - 12 Jul 2021

Closing as having a pull request. Please test #34763 . Thanks in advance.

avatar richard67 richard67 - change - 12 Jul 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-07-12 12:36:27
Closed_By richard67
avatar richard67 richard67 - close - 12 Jul 2021
avatar obuisard
obuisard - comment - 12 Jul 2021

Thank you @richard67, I will test the PR. Thank you so much for looking into this!

Add a Comment

Login with GitHub to post a comment