-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Regression in PostgreSQL HStore dirty check when key order changes #27502
Comments
Thank you for reporting @cupakromer! Investigating... |
From what I could tell the root of the problem seemed to be when it did the changed in place check. When the attribute is Tangentially related to this new use of attributes for changes. I noticed that both the |
Opened #27517 to try and solve this. |
Per the regression commit below, the commit changes the behavior of `#changed?`to consult the `#changed_in_place?` method on `Type::Value` classes. Per this change, `PostgreSQL::OID::Hstore` needs to override this method in order to compare the deserialized forms of the two arguments. In Ruby, two hashes are considered equal even if their key order is different. This commit helps to bring that behavior to `Hstore` values. Fixes regression introduced by 8e633e5 Fixes rails#27502
Per the regression commit below, the commit changes the behavior of `#changed?`to consult the `#changed_in_place?` method on `Type::Value` classes. Per this change, `PostgreSQL::OID::Hstore` needs to override this method in order to compare the deserialized forms of the two arguments. In Ruby, two hashes are considered equal even if their key order is different. This commit helps to bring that behavior to `Hstore` values. Fixes regression introduced by 8e633e5 Fixes rails#27502
Steps to reproduce
This passes on Rails 4.2.7.1 but fails on Rails 5.0.1:
Expected behavior
The record has no changes and should not be saved or marked as dirty.
Actual behavior
The record thinks the HStore has changed. This is causing it to be saved resulting in a cascade of effects which should be avoided (e.g. updates the
updated_at
timestamp, causingtouch
association updates, busting caches and ETags).System configuration
Rails version: 5.0.1
Ruby version: 2.3.3
PostgreSQL version: 9.5.4
The text was updated successfully, but these errors were encountered: