#23834: ArrayField default is an empty string and not None
----------------------------------+-----------------
     Reporter:  ddaan             |      Owner:
         Type:  Bug               |     Status:  new
    Component:  contrib.postgres  |    Version:  1.7
     Severity:  Normal            |   Keywords:
 Triage Stage:  Unreviewed        |  Has patch:  0
Easy pickings:  0                 |      UI/UX:  0
----------------------------------+-----------------
 Considering this class (from tests.postgres_tests.models):

 class NullableIntegerArrayModel(models.Model):
     field = ArrayField(models.IntegerField(), blank=True, null=True)

 When I save it directly after initialization it will result in an error

 django.db.utils.DataError: array value must start with "{" or dimension
 information
 LINE 1: ...ests_nullableintegerarraymodel" ("field") VALUES ('') RETURN...

 This test will reproduce the error

     def test_default_null(self):
         instance = NullableIntegerArrayModel()
         instance.save()
         loaded = NullableIntegerArrayModel.objects.get(pk=instance.pk)
         self.assertEqual(loaded.field, None)
         self.assertEqual(instance.field, loaded.field)

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

Reply via email to