1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix value extracted from negative integers for PostgreSQL.

Fixes: https://github.com/rails/rails/issues/17856.
This commit is contained in:
Guo Xiang Tan 2014-12-01 21:28:50 +08:00
parent 6acd4920c9
commit 0270363f5c
2 changed files with 5 additions and 1 deletions

View file

@ -532,7 +532,7 @@ module ActiveRecord
when 'true', 'false'
default
# Numeric types
when /\A\(?(-?\d+(\.\d*)?\)?(::bigint)?)\z/
when /\A\(?(-?\d+(\.\d*)?)\)?(::bigint)?\z/
$1
# Object identifier types
when /\A-?\d+\z/

View file

@ -36,6 +36,10 @@ class DefaultTest < ActiveRecord::TestCase
assert( "--- []\n\n" == Default.columns_hash['multiline_default'].default ||
"--- []\\012\\012" == Default.columns_hash['multiline_default'].default)
end
def test_default_negative_integer
assert_equal "-1", Default.columns_hash['negative_integer'].default
end
end
end