    # File lib/active_record/connection_adapters/postgresql_adapter.rb, line 313
          def unescape_bytea(value)
            # In each case, check if the value actually is escaped PostgreSQL bytea output
            # or an unescaped Active Record attribute that was just written.
            if 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
                end
              end
            else
              self.class.instance_eval do
                define_method(:unescape_bytea) do |value|
                  if value =~ /\\\d{3}/
                    result = ''
                    i, max = 0, value.size
                    while i < max
                      char = value[i]
                      if char == ?\\
                        if value[i+1] == ?\\
                          char = ?\\
                          i += 1
                        else
                          char = value[i+1..i+3].oct
                          i += 3
                        end
                      end
                      result << char
                      i += 1
                    end
                    result
                  else
                    value
                  end
                end
              end
            end
            unescape_bytea(value)
          end