You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In django-hstore 1.3.4 and earlier, this translated to the following SQL:
WHERE NOT ("app_model"."hstore_field" @> hstore(ARRAY['key_name'], ARRAY['value']) AND"app_model"."hstore_field"IS NOT NULL)
But starting in 1.3.5, it changed to the following:
WHERE NOT (("app_model"."hstore_field"->'key_name') ='value'AND"app_model"."hstore_field"IS NOT NULL)
The latter breaks down when the hstore field is not null but doesn't contain the key. It simplifies as follows:
WHERE NOT (NULL = 'value' AND TRUE)
WHERE NOT (NULL AND TRUE)
WHERE NOT NULL
WHERE NULL
Hence the condition ultimately evaluates as false and the record is excluded, even though we were trying to get records like this one that don't contain the specified key/value combination. The SQL from earlier versions works correctly, because it doesn't throw a NULL into the boolean operations.
The text was updated successfully, but these errors were encountered:
Yea, I'm seeing this as well. Trying to exclude records that have a specific key in the dictionary isn't yielding any rows at all. I'm using django_hstore 1.4.2.
I have a query that includes a condition like the following:
In django-hstore 1.3.4 and earlier, this translated to the following SQL:
But starting in 1.3.5, it changed to the following:
The latter breaks down when the hstore field is not null but doesn't contain the key. It simplifies as follows:
Hence the condition ultimately evaluates as false and the record is excluded, even though we were trying to get records like this one that don't contain the specified key/value combination. The SQL from earlier versions works correctly, because it doesn't throw a NULL into the boolean operations.
The text was updated successfully, but these errors were encountered: