diff options
author | Go MAEDA <maeda@farend.jp> | 2023-10-09 05:30:04 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2023-10-09 05:30:04 +0000 |
commit | bfe619ae7e531db8a003f4a623ff29f120ac0755 (patch) | |
tree | 0ba402874c01cea595b9d603be255c6a8644888d /app | |
parent | ad3e2bdd1b1b141b507bf708bb569973d090d7b9 (diff) | |
download | redmine-bfe619ae7e531db8a003f4a623ff29f120ac0755.tar.gz redmine-bfe619ae7e531db8a003f4a623ff29f120ac0755.zip |
Optimize IssueQuery#sql_for_assigned_to_role_field for PostgreSQL (#38319).
Contributed by Vincent Robert.
git-svn-id: https://svn.redmine.org/redmine/trunk@22334 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/issue_query.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb index 672785cc1..235bf2fbe 100644 --- a/app/models/issue_query.rb +++ b/app/models/issue_query.rb @@ -581,10 +581,10 @@ class IssueQuery < Query sw = operator == "!" ? 'NOT' : '' nl = operator == "!" ? "#{Issue.table_name}.assigned_to_id IS NULL OR" : '' subquery = - "SELECT DISTINCT #{Member.table_name}.user_id" + + "SELECT DISTINCT #{Member.table_name}.user_id, #{Member.table_name}.project_id" + " FROM #{Member.table_name}, #{MemberRole.table_name}" + - " WHERE #{Member.table_name}.project_id = #{Issue.table_name}.project_id AND #{Member.table_name}.id = #{MemberRole.table_name}.member_id AND #{role_cond}" - "(#{nl} #{Issue.table_name}.assigned_to_id #{sw} IN (#{subquery}))" + " WHERE #{Member.table_name}.id = #{MemberRole.table_name}.member_id AND #{role_cond}" + "(#{nl} (#{Issue.table_name}.assigned_to_id, #{Issue.table_name}.project_id) #{sw} IN (#{subquery}))" end end |