1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-02-01 03:57:15 +00:00

Cast as decimal(30,0) instead of integer (#21249).

git-svn-id: http://svn.redmine.org/redmine/trunk@16197 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2017-01-14 12:37:16 +00:00
parent e808c62253
commit 14a98af864

View File

@ -976,7 +976,7 @@ class Query < ActiveRecord::Base
"#{queried_table_name}.id #{not_in} IN (" +
"SELECT customized_id FROM #{CustomValue.table_name}" +
" WHERE customized_type='#{queried_class}' AND custom_field_id=#{custom_field_id}" +
" AND value <> '' AND CAST(value AS integer) IN (" +
" AND CAST(CASE value WHEN '' THEN '0' ELSE value END AS decimal(30,0)) IN (" +
" SELECT customized_id FROM #{CustomValue.table_name}" +
" WHERE customized_type='#{target_class}' AND custom_field_id=#{chained_custom_field_id}" +
" AND #{sql_for_field(field, operator, value, CustomValue.table_name, 'value')}))"
@ -998,7 +998,7 @@ class Query < ActiveRecord::Base
"#{queried_table_name}.id #{not_in} IN (" +
"SELECT customized_id FROM #{CustomValue.table_name}" +
" WHERE customized_type='#{queried_class}' AND custom_field_id=#{custom_field_id}" +
" AND value <> '' AND CAST(value AS integer) IN (" +
" AND CAST(CASE value WHEN '' THEN '0' ELSE value END AS decimal(30,0)) IN (" +
" SELECT id FROM #{target_table_name} WHERE #{sql_for_field(field, operator, value, filter[:field].format.target_class.table_name, attribute)}))"
end