From 8623223a891eb61845029f6d605ea726bb3fe179 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 8 Nov 2018 23:55:09 +0900 Subject: PostgreSQL: Properly quote all `Infinity` and `NaN` Since quoted `Infinity` and `NaN` are valid data for PostgreSQL. --- .../lib/active_record/connection_adapters/postgresql/quoting.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb') 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)) -- cgit v1.2.3