aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRyan Fitzgerald <rwfitzge@gmail.com>2012-04-24 20:43:10 -0700
committerRyan Fitzgerald <rwfitzge@gmail.com>2012-04-24 20:46:51 -0700
commit0c46dbbc4557acb1e0af1c8ce697305398070922 (patch)
tree2c705020e4c200c198fe7566c03c2be1206bdce7 /activerecord/lib
parent0cc32c5fd7f875de61262b430bca23825691899b (diff)
downloadrails-0c46dbbc4557acb1e0af1c8ce697305398070922.tar.gz
rails-0c46dbbc4557acb1e0af1c8ce697305398070922.tar.bz2
rails-0c46dbbc4557acb1e0af1c8ce697305398070922.zip
Always quote hstore keys and values
escape_hstore uses quotation marks around keys and values only if it seems necessary. However, it currently breaks in the presence of some non-ASCII characters. Instead of trying to guess exactly which characters are safe, it seems better to always use quotes.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb3
1 files changed, 1 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 10a178e369..8248eb9d0b 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -88,9 +88,8 @@ module ActiveRecord
def escape_hstore(value)
value.nil? ? 'NULL'
- : value =~ /[=\s,>]/ ? '"%s"' % value.gsub(/(["\\])/, '\\\\\1')
: value == "" ? '""'
- : value.to_s.gsub(/(["\\])/, '\\\\\1')
+ : '"%s"' % value.gsub(/(["\\])/, '\\\\\1')
end
end
# :startdoc: