Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly detect mutation on serialized columns mapping to binary #16702

Merged
merged 1 commit into from
Aug 27, 2014

Conversation

sgrif
Copy link
Contributor

@sgrif sgrif commented Aug 26, 2014

Fixes #16701

@rafaelfranca
Copy link
Member

PostgreSQL build is broken.

@felixbuenemann
Copy link
Contributor

Maybe the failures are because postgres uses Bytea type for binary columns which overrides type_cast_from_databaseof Type::Binary:
activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb

Btw. legacy mysql adapter also failed on travis, but it seems unrelated (segfault).

@felixbuenemann
Copy link
Contributor

@sgrif not sure I fully understand your changes, but maybe this would work:

# ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Bytea
def type_cast_from_database(value)
  return if value.nil?
  Type::Binary::Data.new(PGconn.unescape_bytea(super))
end

This way the return type of type_cast_from_database wouldn't differ for Bytea.

@sgrif
Copy link
Contributor Author

sgrif commented Aug 27, 2014

Updated

rafaelfranca added a commit that referenced this pull request Aug 27, 2014
Correctly detect mutation on serialized columns mapping to binary
@rafaelfranca rafaelfranca merged commit 77f5a70 into rails:master Aug 27, 2014
@sgrif sgrif deleted the sg-binary-serialized branch March 14, 2018 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serialized binary column changes hash never empty
3 participants