Opened 4 years ago
Last modified 4 years ago
#32300 closed Bug
"BIGINT UNSIGNED value is out of range" occurs when substraction operation between PositiveBigIntegerField and BigIntegerField using F() — at Initial Version
Reported by: | jun | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 3.1 |
Severity: | Normal | Keywords: | mysql unsigned |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
- 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")
Note:
See TracTickets
for help on using tickets.