Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
database system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Jul 2016 at 10:26 UTC
Updated:
16 Sep 2022 at 18:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
michel.settembrino commentedReference to old issue added to do not loose history.
Comment #3
q0rban commentedThe patch in #11 on #1145076: UNION queries don't support ORDER BY clauses does not work in our testing of a UNIONed query with an order by. The patch in #7 by cbergmann does. The union being performed is on a View query, using hook_view_pre_execute(). Working patch from #7 is attached here for reference, but does not include tests. Make sure cbergmann gets credit for this if it is expanded on.
Comment #4
stefan.r commentedHmm, why does #11 not work? It works in D8...
The tests you can probably mostly copypaste from #55.
Comment #5
aerozeppelin commentedUploading patch from #11 and #55.
Comment #7
eojthebraveI just ran into this issue. And can confirm that the patch in #5 fixes the issue. And is also the same fix that was applied to Drupal 8. This version just fixes a couple of typos in the comments included with #5.
Comment #8
cgv commentedHi, I think patches #5 and #7 not support order by or limit per union query, so we can't set limits to individuals query and then (optionally) apply a global limit. Patch #3 tries to solve it but have a little error that I solve in this patch.
Comment #9
c7bamford commented#7 works for me. #8 fails on queries using multiple unions.
Comment #10
sgdev commentedPatch #7 works for me too.
Comment #11
poker10 commentedThe patch from #7 is working correctly, we are also using it on some projects. Also it is a complete backport of the D8 issue with tests included.
Reuploading the unchanged patch from #7 with a test only version to verify the failure. If there would not be any problems with the testbot results, this can be set as RTBC.
Regarding to comment #8: Thanks for the report, but I think we will need to create followup for this if needed. The code in D9 is the same as in the patch #7, so we cannot make any additional changes here without checking the problem in D9 first.
Comment #13
poker10 commentedChanging the status to RTBC as mentioned in #11.
Comment #14
mcdruid commentedD9 code for comparison:
https://git.drupalcode.org/project/drupal/-/blob/9.4.5/core/lib/Drupal/C...
...and the tests:
https://git.drupalcode.org/project/drupal/-/blob/9.4.5/core/tests/Drupal...
This looks good to me, thanks!
Comment #19
poker10 commentedComment #28
poker10 commentedThanks all who contributed!
Just an additional note to #8:
As @daffie mentioned here: #1145076-41: UNION queries don't support ORDER BY clauses , we cannot easily add that support:
I have also added credits from the parent issue.