]> source.dussan.org Git - redmine.git/commitdiff
Fix PostgreSQL error caused by comparing text with integer values (#38527).
authorGo MAEDA <maeda@farend.jp>
Thu, 11 May 2023 04:04:51 +0000 (04:04 +0000)
committerGo MAEDA <maeda@farend.jp>
Thu, 11 May 2023 04:04:51 +0000 (04:04 +0000)
git-svn-id: https://svn.redmine.org/redmine/trunk@22242 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/query.rb

index f4bbfb5cdd2fa749e0289b144584f513fdbc79c5..117f6e226e193485bbff0190fe150781602ac69e 100644 (file)
@@ -1456,11 +1456,11 @@ class Query < ActiveRecord::Base
           " AND #{JournalDetail.table_name}.property = 'attr'" +
           " AND #{JournalDetail.table_name}.prop_key = '#{db_field}'" +
           " AND " +
-          queried_class.send(:sanitize_sql_for_conditions, ["#{JournalDetail.table_name}.old_value IN (?)", value]) +
+          queried_class.send(:sanitize_sql_for_conditions, ["#{JournalDetail.table_name}.old_value IN (?)", value.map(&:to_s)]) +
           ")"
         if %w[ev !ev].include?(operator)
           subquery <<
-            " OR " + queried_class.send(:sanitize_sql_for_conditions, ["#{db_table}.#{db_field} IN (?)", value])
+            " OR " + queried_class.send(:sanitize_sql_for_conditions, ["#{db_table}.#{db_field} IN (?)", value.map(&:to_s)])
         end
         sql = "#{neg} EXISTS (#{subquery})"
       else