﻿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
16747	IntegerField could validate too large numbers to work with PostgreSQL and MySQL be default	Petr Marhoun <petr.marhoun@…>	nobody	"Be default (without some additional validation) integer fields in Django do not checks any intervals for inserted numbers. So for example, if someone try official tutorial from Django documentation and use recommended database (PostgreSQL), he can get uncatched exception (""!DatabaseError: integer out of range""). It would be nice to validate this range - it is problem not only for PostgreSQL but also for MySQL (but I do not know if these two databases are so important that they should define interval common for all databases).

!BigIntegerField in Django checks interval [2 ^63^, 2 ^63^ - 1] so for consistency !IntegerField could check interval [2 ^31^, 2 ^31^ -1]. Also, for other main fields (for example char fields or float fields or decimal fields or date fields) it is quite difficult or impossible to get uncatched exceptions - but it is really easy for integer fields.

I prepare patch with two tests - one (for !BigIntegerField) passes on all tested databases (PostgreSQL 8.4.8, MySQL 5.1.54 with InnoDB, SQlite from Python 2.7.1 - everything on Ubuntu 11.04 64bit). The almost same second one (for !IntegerField) failes on PostgreSQL with ""!DatabaseError: integer out of range"" and on MySQL with ""!AssertionError"" (saved number is truncated)."	Bug	closed	Database layer (models, ORM)	dev	Normal	wontfix			Unreviewed	1	0	0	0	0	0
