プロジェクト

全般

プロフィール

Vote #77806

完了

"Invalid query" (Error 500) message with MS SQL when displaying an issue from a list grouped and sorted by fixed version

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Issues_2
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
2
version_id:
120
issue_org_id:
23839
author_id:
80618
assigned_to_id:
1
comments:
5
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
109
ステータス-->[Closed]

説明

Steps:
Prerequisite: this happens only with MS SQL

Filter a list of issues by grouping on the fixed version field, and showing the priority field

Click on the Fixed version field to sort on it in descending order, click on the priority field to also sort on that field

This should result in a query like "this one":https://www.redmine.org/projects/redmine/issues?c[]=tracker&c[]=status&c[]=author&c[]=subject&c[]=fixed_version&c[]=due_date&c[]=priority&f[]=status_id&f[]=assigned_to_id&f[]=fixed_version_id&f[]=&group_by=fixed_version&op[assigned_to_id]=%3D&op[fixed_version_id]=%3D&op[status_id]=o&set_filter=1&sort=priority%3Adesc%2Cfixed_version%3Adesc%2Cid%3Adesc&utf8=%E2%9C%93&v[assigned_to_id][]=1&v[fixed_version_id][]=121&v[fixed_version_id][]=122&v[fixed_version_id][]=119 for example

Click on one bug of the list

Result: Error 500, Invalid query. In the log, it is indicated that there are duplicated column names in an ORDER BY clause
Note: the issue also happens on MySQL, but MySQL does not consider duplicated sort columns as an error.

The issue happens in the feature to be able to navigate with arrows to the next or previous bug in the list we came from.
As the Fixed_version field implements a call back with its own sortable columns, this comes into the group_by_sort_order statement, which then brings columns duplicated with the ones coming from the options.

Note that with a MySQL-backed Redmine site, the effect is that the order of the list can be incorrect in the previous/Next arrows on the displayed bug.

See attached patch for a suggested fix.


journals

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
It's nicer when testing for non-nil object before calling a method on it (map)... sorry for the bugged previous patch.
... and forgot to save after adding missing spaces on last line...
--------------------------------------------------------------------------------
Different fix applied in r15852 with a test. Thanks for pointing this out.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリIssues_2 にセット
  • 対象バージョン3.1.7_120 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0