Feature #38301 » 38301-fix-sql-error-when-invalid-value-is-passed.patch
app/models/issue_query.rb | ||
---|---|---|
736 | 736 |
" WHERE #{IssueRelation.table_name}.relation_type =" \ |
737 | 737 |
" '#{self.class.connection.quote_string(relation_type)}')" |
738 | 738 |
when "=", "!" |
739 |
return '1=0' if ids.empty? |
|
740 | ||
739 | 741 |
op = (operator == "=" ? 'IN' : 'NOT IN') |
740 | 742 |
"#{Issue.table_name}.id #{op}" \ |
741 | 743 |
" (SELECT DISTINCT #{IssueRelation.table_name}.#{join_column}" \ |
test/unit/query_test.rb | ||
---|---|---|
1650 | 1650 |
query.filters = {"relates" => {:operator => '=', :values => ['1,2']}} |
1651 | 1651 |
assert_equal [1, 2, 3], find_issues_with_query(query).map(&:id).sort |
1652 | 1652 | |
1653 |
query = IssueQuery.new(:name => '_') |
|
1654 |
query.filters = {"relates" => {:operator => '=', :values => ['invalid']}} |
|
1655 |
assert_equal [], find_issues_with_query(query).map(&:id) |
|
1656 | ||
1653 | 1657 |
query = IssueQuery.new(:name => '_') |
1654 | 1658 |
query.filters = {"relates" => {:operator => '!', :values => ['1']}} |
1655 | 1659 |
assert_equal Issue.where.not(:id => [2, 3]).order(:id).ids, find_issues_with_query(query).map(&:id).sort |
- « Previous
- 1
- 2
- Next »