diff options
author | Sven Bohm <bohms@msu.edu> | 2011-11-21 13:14:16 -0500 |
---|---|---|
committer | Sven Bohm <bohms@msu.edu> | 2011-11-21 13:14:16 -0500 |
commit | 06c23c4c7ff842f7c6237f3ac43fc9d19509a947 (patch) | |
tree | eafdf9417c6eef3a63b82558fbaec2d715e4cc0d /activerecord/lib | |
parent | 5d704fa152c2f2846b66973cf5572e3120a72792 (diff) | |
download | rails-06c23c4c7ff842f7c6237f3ac43fc9d19509a947.tar.gz rails-06c23c4c7ff842f7c6237f3ac43fc9d19509a947.tar.bz2 rails-06c23c4c7ff842f7c6237f3ac43fc9d19509a947.zip |
postgresql adapter handles quoting of not a number (NaN) and Infinity
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 2f01fbb829..0b102d787a 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -415,8 +415,13 @@ module ActiveRecord case value when Float - return super unless value.infinite? && column.type == :datetime - "'#{value.to_s.downcase}'" + if value.infinite? && column.type == :datetime + "'#{value.to_s.downcase}'" + elsif value.infinite? || value.nan? + "'#{value.to_s}'" + else + super + end when Numeric return super unless column.sql_type == 'money' # Not truly string input, so doesn't require (or allow) escape string syntax. |