Permalink
Browse files

PostgreSQL: remove the unnecessary heuristic checking whether the val…

…ue is escaped
  • Loading branch information...
1 parent c9e1570 commit 5c0ad822363f15d372caaee8b39f3c0e89a13503 @jeremy jeremy committed Apr 24, 2010
Showing with 2 additions and 10 deletions.
  1. +2 −10 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -326,21 +326,13 @@ def unescape_bytea(original_value)
if @connection.respond_to?(:unescape_bytea)
self.class.instance_eval do
define_method(:unescape_bytea) do |value|
- if value =~ /\\\d{3}/
- @connection.unescape_bytea(value)
- else
- value
- end
+ @connection.unescape_bytea(value) if value
end
end
elsif PGconn.respond_to?(:unescape_bytea)
self.class.instance_eval do
define_method(:unescape_bytea) do |value|
- if value =~ /\\\d{3}/
- PGconn.unescape_bytea(value)
- else
- value
- end
+ PGconn.unescape_bytea(value) if value
end
end
else

0 comments on commit 5c0ad82

Please sign in to comment.