-
Notifications
You must be signed in to change notification settings - Fork 270
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
Native JSON type for PostgreSQL 9.2+ causing problems with Django 1.5 in some conditions #47
Comments
Hey @Karmak23 thanks for the bug report and pull request. Actually just yesterday I saw a reference to an incomplete 9.2 implementation and was planning on looking into it––thanks for doing it for me! PR is pulled in. Cheers :) |
Actually the same problem happens in 9.3. It seems to be because of a |
Agree with @ewjoachim. For For reference: https://docs.djangoproject.com/en/dev/ref/models/querysets/#distinct I'm using Postgresql version |
The work around for this in the Django admin is to subclass |
I think the better and less volatile work around would be to subclass the postgres db backend class and from json type fields from there. |
Or perhaps it's better to subclass django's sql compiler. Oh well. |
Pull request for rpkilby#47
PostgreSQL is giving error: could not identify an equality operator for type json This bug report is about the issue: rpkilby/jsonfield#47
Hi,
I managed to hunt a bug back to #32 . I use PG 9.2 on OSX, and the native JSON type has been causing me a headache in some very corner-cased situation. Here the stacktrace given by Django:
http://dev.1flow.net/development/1flow-dev/group/82/
As you can see, the traditionnal Django message about transaction aborted doesn't help at all, but if I manage to run the culprit SQL query on my PG9.2, I get:
Having trying to hunt down the problem during a fair long amount of time, I found these:
http://michael.otacoo.com/postgresql-2/postgres-9-2-highlight-json-data-type/
http://michael.otacoo.com/postgresql-2/postgres-9-3-feature-highlight-json-operators/
Which clearly define that JSON operators comes only in PG9.3. I thus consider the 9.2 support for JSON kind of incomplete. In django, selecting any json column in a query seems to crash PG. Any request on the table, but not involving the json fields, is OK.
On my production machines I have PG 9.1 and luckily the JSON fields are stored as
text
there, so they don't crash Django. I think that injsonfield/fields.py
:Should really be
connection.pg_version >= 90300:
To avoid messing with the 9.2 incomplete implementation. In fact, i've create a pull request because reverting totext
makes everything work again on my 9.2 server. Sorry, I don't seem to find how to merge the pull request with the current issue in the github interface.NOTE: I have no PG 9.3 to test if the implementation works or not.
Best regards,
The text was updated successfully, but these errors were encountered: