﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32300	"""BIGINT UNSIGNED value is out of range"" occurs when substraction operation between PositiveBigIntegerField and BigIntegerField using F()"	jun	nobody	"* Environment
{{{
MacOS 10.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"")



"	Bug	closed	Database layer (models, ORM)	3.1	Normal	wontfix	mysql unsigned		Unreviewed	0	0	0	0	0	0
