diff options
author | Stan Hu <stanhu@gmail.com> | 2016-06-18 20:55:45 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-06-18 23:07:38 +0300 |
commit | 7c9eba891963451a1feb2e5bbef90fdcac1496ff (patch) | |
tree | 51692ed3b138406a8d0bc740eb259076e91e4361 /lib/gitlab/database.rb | |
parent | 00906b5bb6cde8cb60281109060a519a54000c61 (diff) |
Fix RangeError exceptions when referring to issues or merge requests outside of max database values
When using #XYZ in Markdown text, if XYZ exceeds the maximum value of a signed 32-bit integer, we
get an exception when the Markdown render attempts to run `where(iids: XYZ)`. Introduce a method
that will throw out out-of-bounds values.
Closes #18777
Diffstat (limited to 'lib/gitlab/database.rb')
-rw-r--r-- | lib/gitlab/database.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/gitlab/database.rb b/lib/gitlab/database.rb index d76ecb54017..078609c86f1 100644 --- a/lib/gitlab/database.rb +++ b/lib/gitlab/database.rb @@ -1,5 +1,10 @@ module Gitlab module Database + # The max value of INTEGER type is the same between MySQL and PostgreSQL: + # https://www.postgresql.org/docs/9.2/static/datatype-numeric.html + # http://dev.mysql.com/doc/refman/5.7/en/integer-types.html + MAX_INT_VALUE = 2147483647 + def self.adapter_name connection.adapter_name end |