Code

Opened 5 years ago

Closed 10 months ago

#11998 closed Bug (duplicate)

IntegerField not validated for overflow

Reported by: francis.giraldeau@… Owned by: tobias
Component: Database layer (models, ORM) Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Alex)

Let be this small model :

class IntegerOverflowTest(models.Model):
    someint = models.IntegerField()

For mysql, maximum values for signed integer is 2147483647 [1]

In admin interface, defining a value more than the maximum raises this exception :

    Warning : Out of range value for column 'someint' at row 1

I would have expected that the form to be validated and prompt the error gracefully.

[1] http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html

Attachments (0)

Change History (11)

comment:1 Changed 5 years ago by francis.giraldeau@…

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

A small note : this warning is not raised while using sqlite3. It's reproducible under at least mysql.

comment:2 Changed 5 years ago by Alex

  • Description modified (diff)

Please use preview.

comment:3 Changed 5 years ago by thejaswi_puthraya

  • Component changed from Uncategorized to Database layer (models, ORM)

comment:4 Changed 5 years ago by tobias

  • Owner changed from nobody to tobias
  • Status changed from new to assigned

comment:5 Changed 5 years ago by tobias

  • Resolution set to duplicate
  • Status changed from assigned to closed

This sounds like model validation to me.. closing as duplicate of #6845

comment:6 Changed 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

comment:7 Changed 21 months ago by anonymous

  • Easy pickings unset
  • Severity set to Normal
  • Type set to Uncategorized
  • UI/UX unset
  • Version changed from 1.1 to 1.4

Problem persists in 1.4.1

comment:8 Changed 20 months ago by anonymous

  • Resolution duplicate deleted
  • Status changed from closed to reopened
  • Type changed from Uncategorized to Bug

Problem persists in 1.4.2

Following fields also raise same exception.

  • BigIntegerField
  • PositiveIntegerField
  • PositiveSmallIntegerField
  • SmallIntegerField

comment:9 follow-up: Changed 20 months ago by baltazarfo@…

  • Needs documentation set
  • Resolution set to fixed
  • Status changed from reopened to closed
  • Triage Stage changed from Unreviewed to Accepted

comment:10 in reply to: ↑ 9 Changed 10 months ago by amcharg@…

  • Resolution fixed deleted
  • Status changed from closed to new
  • Triage Stage changed from Accepted to Unreviewed

Replying to baltazarfo@…:
Just checked with 1.4.6 and this seems to still be an issue with postgresql at least. Checked the code and I don't see any validators being added. I assume any fix for this would raise a ValidationError or like BigIntegerField pass min_value or max_value to the form field.

I can write a failing test if that helps.

comment:11 Changed 10 months ago by timo

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #12030

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.