#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 felixxm):

 > The fields which were getting this error were originally using a custom
 `JSONField`, which was a subclass of `models.TextField`, and so presumably
 their original DB column type was `text`. I then changed them to use the
 native `models.JSONField`, and got Django to automatically create a
 migration (which contains a `migrations.AlterField` operation for each
 field, converting them to the native `models.JSONField`).
 >
 > The weird thing is that that migration converted the DB columns to type
 `json` rather than `jsonb`.

 Django have never used the `json` datatype, so it's not possible that it
 used `json` type in migrations. Can you provide more detail about this
 custom `JSONField`? Was it your own implementation or a field provided by
 3rd-party package?

 > I can fix that in my own DB, no problem. But the remaining question is
 this: is that behaviour unexpected and should we fix it?

 I cannot reproduce it (custom `JSONField(TextField)` -> `models.JSONField`
 works for me). Can you provide a small sample project that reproduces this
 issue?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31973#comment:5>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.a964904bc7d1561cd507754ecde0b3d5%40djangoproject.com.

Reply via email to