#28291: ArrayField cannot contain JSONField; causes SQL error
--------------------------------------------+------------------------
               Reporter:  Richard Eames     |          Owner:  (none)
                   Type:  Bug               |         Status:  new
              Component:  contrib.postgres  |        Version:  master
               Severity:  Normal            |       Keywords:
           Triage Stage:  Unreviewed        |      Has patch:  0
    Needs documentation:  0                 |    Needs tests:  0
Patch needs improvement:  0                 |  Easy pickings:  0
                  UI/UX:  0                 |
--------------------------------------------+------------------------
 Using `JSONField` as the subfield of `ArrayField` causes an error with
 casting:
 {{{
 psycopg2.ProgrammingError: column "field" is of type jsonb[] but
 expression is of type text[]
 LINE 1: ..."postgres_tests_jsonarraymodel" ("field") VALUES (ARRAY['{"a...

 }}}

 Testcase:
 {{{
 #!python
 class JSONArrayModel(PostgreSQLModel):
     field = ArrayField(JSONField(default=dict))

 instance = JSONArrayModel(field=[{'a': 1 }, {'b': 2}])
 instance.save()
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28291>
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.4c2e805984199cc0fdfc53fcd3eb9bc1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to