#32300: "BIGINT UNSIGNED value is out of range" occurs when substraction 
operation
between PositiveBigIntegerField and BigIntegerField using F()
-------------------------------------+-------------------------------------
               Reporter:  jun        |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  3.1
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:  F expression
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 * Environment
 {{{
 MacOS 0.15.3
 Django 3.1
 MySQL 5.7.32
 mysqlclient==2.0.1
 }}}

 * Model
 {{{
 class SomeModel(models.Model):
     positive_big_int_column = models.PositiveBigIntegerField(default=0)
     big_int_column = models.BigIntegerField(default=0)
 }}}

 * Test
 {{{
 SomeModel.objects.create(positive_big_int_column=100, big_int_column=300)
 qs = SomeModel.objects.filter(positive_big_int_column=100)
 qs.update(big_int_column=F('positive_big_int_column') -
 F('big_int_column'))
 }}}

 * Expected query
 UPDATE SomeModel SET big_int_column=(100-300)


 * Error
 IntegrityError: (1690, "BIGINT UNSIGNED value is out of range in blabla")

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32300>
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/051.b11c1baa2f6ddbd24f0768dd122ad429%40djangoproject.com.

Reply via email to