? ? Success

User tests: Successful: Unsuccessful:

avatar SharkyKZ
SharkyKZ
28 Sep 2018

Pull Request for Issue # .

Summary of Changes

Use type_alias instead of type_title in the query to prevent possible overwriting of 3rd party extensions.

Testing Instructions

Code review.

avatar SharkyKZ SharkyKZ - open - 28 Sep 2018
avatar SharkyKZ SharkyKZ - change - 28 Sep 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 28 Sep 2018
Category SQL Administration com_admin Postgresql MS SQL
avatar SharkyKZ
SharkyKZ - comment - 28 Sep 2018

What's the consensus on updating old SQL files? Because there are more instances of this.

avatar Quy
Quy - comment - 27 May 2019

Maybe you can find the answer in 22754.

avatar SharkyKZ
SharkyKZ - comment - 18 Jun 2019

That's fine for copyright changes. But if existing code can potentially cause issues, it should be updated.

avatar brianteeman
brianteeman - comment - 18 Jun 2019

What's the consensus on updating old SQL files? Because there are more instances of this.

What is the benefit of doing that? As long as the current sql is correct thats all that matters.

avatar SharkyKZ
SharkyKZ - comment - 18 Jun 2019

It's not. If you have a 3rd component with Article type title, this SQL is going to affect it as well. Although neither type_alias nor type_title column is unique in the database, we can assume that type_alias is used as such. I.e. you should not have multiple row with com_content.article alias in the table. But you can have com_example.article and com_content.article, as well as multiple entries with title Article.

avatar brianteeman
brianteeman - comment - 18 Jun 2019

My comment was about updating the old sql only

avatar SharkyKZ
SharkyKZ - comment - 18 Jun 2019

Old SQLs have the same potential issue.

avatar brianteeman
brianteeman - comment - 18 Jun 2019

But they will never be the sql used on a site. Or am I missing something.

avatar HLeithner
HLeithner - comment - 18 Jun 2019

if you update form < 3.9 you execute this sql file and it should be changed because it's wrong

avatar brianteeman
brianteeman - comment - 18 Jun 2019

As long as the last of the update sql files is correct thats all the matters. There is no point in going back through all the existing update sql and changing them. At least thats my understanding of the question about OLD sql files

avatar HLeithner
HLeithner - comment - 18 Jun 2019

if we have sql query that can break a website because our query is wrong it has to be changed.

And thats the problem here, we break websites having an extensions matching the query in the SQL. The reason for this is because the where clause doesn't match a unique core field instead it match a field used by any component.

avatar brianteeman
brianteeman - comment - 18 Jun 2019

I am obviously really stupid then as I still don't see the need to change an OLD update sql file.

Site is on Joomla 3.9.1 and updates
update-3.9.2.sql is applied (still with the error)
update-3.9.3.sql is applied (still with the error)
update-3.9.4.sql is applied (still with the error)
update-3.9.5.sql is applied (still with the error)
update-3.9.6.sql is applied (still with the error)
update-3.9.7.sql is applied (still with the error)
update-3.9.8.sql is applied (with the correction)

So why do you go back in time and apply the fix to update-3.9.4.sql etc

avatar HLeithner
HLeithner - comment - 18 Jun 2019

Site is on 3.8.0 then it get executed.

avatar SharkyKZ
SharkyKZ - comment - 18 Jun 2019

@brianteeman I'm not talking about every SQL file, only those that contain similar errors, for example:

UPDATE `#__content_types` SET `table` = '{"special":{"dbtable":"#__content","key":"id","type":"Content","prefix":"JTable","config":"array()"},"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}' WHERE `type_title` = 'Article';

avatar brianteeman
brianteeman - comment - 18 Jun 2019

@SharkyKZ I stand by my comments. If that file with the incorrect sql is applied it will be later updated by the correct sql file.

avatar HLeithner
HLeithner - comment - 18 Jun 2019

@brianteeman I think you don't understand the problem. It's not possible to fix it after we broke it because we have a data loss after this sql statement.

avatar mbabker
mbabker - comment - 18 Jun 2019

There is no way to create a new update file to "fix" any damage created by the pre-patch version of these files, the WHERE condition is too broad and potentially updates rows it wasn't intended to in the right conditions. This patch adjusts those queries so they are more correctly limited to only the rows the original author actually intended to touch. So it fixes a problem in that someone updating from 3.8 or earlier will not have an overly eager query applied which may introduce issues to their #__content_types tables, but there is not a way to introduce a new UPDATE query that reverses this one.

This is in part why data updates do not belong in an API that should ONLY be dealing with schema changes...

avatar richard67
richard67 - comment - 1 Mar 2020

I have tested this item successfully on 49efcaa

This PR is correct, I agree with the explanation by @mbabker here: #22419 (comment).


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

avatar richard67 richard67 - test_item - 1 Mar 2020 - Tested successfully
avatar Quy
Quy - comment - 3 Mar 2020

I have tested this item successfully on 49efcaa


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

avatar Quy Quy - test_item - 3 Mar 2020 - Tested successfully
avatar Quy Quy - change - 3 Mar 2020
Status Pending Ready to Commit
avatar Quy
Quy - comment - 3 Mar 2020

RTC


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

avatar HLeithner HLeithner - change - 4 Mar 2020
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-03-04 20:40:30
Closed_By HLeithner
Labels Added: ?
avatar HLeithner HLeithner - close - 4 Mar 2020
avatar HLeithner HLeithner - merge - 4 Mar 2020
avatar HLeithner
HLeithner - comment - 4 Mar 2020

Thanks finally.

Add a Comment

Login with GitHub to post a comment