MySQL's int column is 4 bytes long. If you need to go (2^32) - 1 is the largest value that will fit in an unsigned int and (2^31) - 1 is the largest that will fit in a signed int. This is because 2^32, in binary, is a 1 with 32 zeroes after it--likewise 2^31 is a 1 with 31 zeroes after is. Subtracting 1 from those number makes them 32 or 31 bits wide, all containing 1s. If you need larger numbers, you need a bigint column.
Also, int(12), int(13), int(14), etc. all have the same range. The number just tells MySQL to left-pad the number with zeros to the specified length when returning it in a query. MySQL documentation page here: http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html If anything about my explanation isn't clear, I can try to clarify for you. --James Nader wrote: > Hallo, > > I have a model in which one field value can be a large integer value > (from 2^0=1 till 2^32=4294967296). > > poolMaskID = models.IntegerField(choices=[(pow(2,elm), '2^%s=%s' % > (elm, pow(2,elm))) > for elm in range(33)]) > > The definition of attribute in MySQL database is: > > poolMaskID int(11) > > If want to try to input the 2^31 or 2^32 I get the next 'Warning': > > Out of range value adjusted for column 'poolMaskID' at row 1! > > I have tried to change the attribute definition in MySQL database and > have changed the "postMaskID" to int(12)..... int(16). This was > without any result. I have once used 'models.Positive.IntegerField' > in place of 'models.IntegerField'. The problem has been stayed the > same. > Does somebody any idea about this problem? > > Regards, > Nader --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

