? Pending

User tests: Successful: Unsuccessful:

avatar luredweb
luredweb
5 Sep 2019

Pull Request for Issue # .

Summary of Changes

Add parentheses to Order By

Testing Instructions

Create new Blog Menu with order by Published Up (Most Recent First ) DESC

Expected result

Order by Published Up DESC

Actual result

Order by Published Up ASC

Documentation Changes Required

No

avatar luredweb luredweb - open - 5 Sep 2019
avatar luredweb luredweb - change - 5 Sep 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 5 Sep 2019
Category Front End com_content
avatar franz-wohlkoenig franz-wohlkoenig - change - 6 Sep 2019
Title
Ordering by date DESC is not working.
Ordering by date DESC is not working
avatar franz-wohlkoenig franz-wohlkoenig - edited - 6 Sep 2019
avatar Quy Quy - change - 29 Sep 2019
Labels Added: ?
avatar Quy Quy - close - 29 Sep 2019
avatar Quy Quy - change - 29 Sep 2019
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2019-09-29 22:27:00
Closed_By Quy
avatar Quy
Quy - comment - 29 Sep 2019

Changes in this PR will not affect the sort order. If your articles do not have published dates, then they will fall back to sorting by created dates.


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

avatar luredweb
luredweb - comment - 21 Oct 2019

Hi Quy, The problem is ORDER BY on mysql > 5.6 is not working.


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

avatar Quy Quy - reopen - 21 Oct 2019
avatar Quy Quy - change - 21 Oct 2019
Status Closed Pending
Closed_Date 2019-09-29 22:27:00
Closed_By Quy
avatar richard67
richard67 - comment - 9 Nov 2019

@luredweb @Quy I can't reproduce the issue. On current staging with MySQL 5.7, I get the correct order without this PR applied. Applying this PR does not change anything for me.

avatar richard67
richard67 - comment - 9 Nov 2019

@waader Could you test with your MySQL 8 if you have the issue which shall be solved with this PR, as this is the version which comes with the most strict default setup? On MySQL 5.7 I did not have the issue, so the PR does nothing for me.

avatar richard67
richard67 - comment - 9 Nov 2019

@Quy Let's see if we can get some tester with MySQL 8. I don't have my new, additional testing environment ready yet. In MySQL 8, the default setup uses strict modes and so on, which on previous versions beginning with 5.7 could be set, too, but not were set with the default setup. So maybe @luredweb ran into an issue which I can't reproduce on 5.7 because I have the default setup, and he maybe uses a hosting provider's db where some settings are changed to more modern and safe ones, e.g. strict mode.

avatar richard67
richard67 - comment - 9 Nov 2019

Regarding the SQL: Normally you include such an "CASE ... WHEN" into the columns to be selected and give it a column alias in the "SELECT", and in the "ORDER BY" you just use this column alias, but changing this in our PHP at this place would be a bigger change outside the skope of this PR, I think.

What could be a problem is that in strict mode, mysql might behave (haven't checked docs) like standard sql and only accepts columns or expressions in order by which are part of the selected columns. I.e. a "SELECT thiscolumn FROM thattable ORDER BY someothercolumn;" would result in an SQL error.

But then I would expect for this issue here an SQL error and not a wrong ordering direction, this is what confuses me a bit.

avatar Quy Quy - change - 18 Nov 2019
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2019-11-18 18:35:28
Closed_By Quy
avatar Quy Quy - close - 18 Nov 2019
avatar Quy
Quy - comment - 18 Nov 2019

Can't reproduce using MySQL 5.7.23-cll-lve.


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

avatar luredweb
luredweb - comment - 21 May 2021

Hi. I reopened this because it's happen when you have multilingual

avatar sandramay0905
sandramay0905 - comment - 22 May 2021

@luredweb

it's happen when you have multilingual

Test on English on a Multilangual site (mysql 5.7.30-cll-lve). If i understand you correct it works, but maybe i need more information.

Add a Comment

Login with GitHub to post a comment