djangonauts / django-pgjson

PostgreSQL json field support for Django
http://djangonauts.github.io/django-pgjson/
Other
131 stars 39 forks source link

Fix 1 of 2 for #12 #13

Closed lanzz closed 9 years ago

lanzz commented 9 years ago

The output field of the KeyTransform is a CharField

The ->> operator always evaluates to a textual representation of the JSON value, so the key transform results in a char-like value

Two tests fail and have been commented out: comparisons like .filter(field__at_key={ "some": [ "complex", { "json": construct" } ] }) aren't really possible for JSON fields; that would compare the textual JSON serialization of the value stored in Postgres against the textual JSON serialization produced by Python's json.dumps. Those are definitely not guaranteed to match, especially with regard to dictionary key order. The test cases are so trivial that they pass by chance, but might lead people to believe they can do things with JSON fields that they can't really do.

niwinz commented 9 years ago

You are right! Thanks!