Merge pull request #17680 from larskanis/fix_bytea_change_detection
PostgreSQL, Fix change detection caused by superfluous bytea unescaping
This commit is contained in:
commit
322750e213
@ -5,6 +5,7 @@ module OID # :nodoc:
|
||||
class Bytea < Type::Binary # :nodoc:
|
||||
def type_cast_from_database(value)
|
||||
return if value.nil?
|
||||
return value.to_s if value.is_a?(Type::Binary::Data)
|
||||
PGconn.unescape_bytea(super)
|
||||
end
|
||||
end
|
||||
|
@ -688,7 +688,14 @@ def type_cast_for_database(value)
|
||||
serialize :data
|
||||
end
|
||||
|
||||
klass.create!(data: "foo")
|
||||
binary = klass.create!(data: "\\\\foo")
|
||||
|
||||
assert_not binary.changed?
|
||||
|
||||
binary.data = binary.data.dup
|
||||
|
||||
assert_not binary.changed?
|
||||
|
||||
binary = klass.last
|
||||
|
||||
assert_not binary.changed?
|
||||
|
Loading…
Reference in New Issue
Block a user