diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-11-08 23:55:09 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-11-09 00:05:39 +0900 |
commit | 8623223a891eb61845029f6d605ea726bb3fe179 (patch) | |
tree | 89ef1732b233110ba0af9853ed8e142575458381 /activerecord/lib/active_record | |
parent | 4fe27cdc15b88fed5ae725a886b7e96202f649a8 (diff) | |
download | rails-8623223a891eb61845029f6d605ea726bb3fe179.tar.gz rails-8623223a891eb61845029f6d605ea726bb3fe179.tar.bz2 rails-8623223a891eb61845029f6d605ea726bb3fe179.zip |
PostgreSQL: Properly quote all `Infinity` and `NaN`
Since quoted `Infinity` and `NaN` are valid data for PostgreSQL.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb index e75202b0be..0895d06356 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb @@ -93,11 +93,11 @@ module ActiveRecord elsif value.hex? "X'#{value}'" end - when Float - if value.infinite? || value.nan? - "'#{value}'" - else + when Numeric + if value.finite? super + else + "'#{value}'" end when OID::Array::Data _quote(encode_array(value)) |