#31973: TypeError loading data in JSONField if DB has native JSON support -------------------------------------+------------------------------------- Reporter: Adam Alton | Owner: nobody Type: Bug | Status: closed Component: Database layer | Version: 3.1 (models, ORM) | Severity: Normal | Resolution: needsinfo Keywords: | Triage Stage: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Adam Alton): I've now dug further into what happened in my case. It turns out that I actually wrote a custom migration when I moved from the custom `JSONField` (which subclassed `models.TextField`) to the built- in `models.JSONField`. I think I must have underestimated how clever Django would be in doing that conversion, and so I wrote a custom `migrations.RunSQL`, assuming that Django wouldn't do the right conversion for me. My custom migration did something like this: {{{ ALTER TABLE my_table ALTER COLUMN my_field TYPE JSON USING my_field::JSON; }}} I'd totally forgotten about this (and failed to see it when I looked through my migrations before I raised this ticket). So in my case, I'm pretty sure that the problem was my own fault for doing `my_field::JSON` instead of `my_field::JSONB`. (And for assuming that Django wouldn't be clever enough to do this for me!) Sorry for the false alarm on this ticket, and thank you @felixxm for your help. I hope that this info helps the other people who've got this error to get to the bottom of what's going on in their case. But whatever it is, my guess is that it's not a bug in Django! -- Ticket URL: <https://code.djangoproject.com/ticket/31973#comment:14> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.f56c36f95cb33637eca9ca866f2a758c%40djangoproject.com.