List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 5 1999 10:25pm
Subject:Re: value changed on insert
View as plain text  
At 5:12 PM -0500 7/5/1999, Peter J. Schoenster wrote:
>I grabbed 'time' and incremented it by one for each record I was
>preparing to insert into a database.
>I was trying to insert this int:
>into this field:
>aid int(4)
>and then this gets inserted:
>and mysql changes int(4) to int(11) .
>Why does it change the value of my insert?  Also aid is the
>I just used a number count from 0 and all went well -- otherwise when
>I went to insert  the data mysql told me I had a duplicate key -- it
>seemed it was changing all the aid values to 2147483647.

That's the upper limit of the range for INT columns.  From the manual:


A normal-size integer. The signed range is @code{-2147483648} to
@code{2147483647}.  The unsigned range is @code{0} to @code{4294967295}.

If you insert values outside of the range, the values are clipped to
the appropriate endpoint of the range before insertion.

Your "(4)" in "int(4)" is the display size.  It has nothing to do with the
storage size of the underlying data type (in constrast to a
type such as char(4), where the (4) determines the storage size).

By the way, what did you mean by the following statement?

>and mysql changes int(4) to int(11) .

Paul DuBois, paul@stripped
Northern League Chronicles:
Current Datetoxalot5 Jul
  • Re: Current DateMartin Ramsch5 Jul
  • Re: Current DatePaul DuBois5 Jul
  • ORDER BY numericallyAaron Johnson5 Jul
    • Re: ORDER BY numericallyPaul DuBois6 Jul
    • value changed on insertPeter J. Schoenster6 Jul
      • Re: value changed on insertPat Sherrill6 Jul
      • Re: value changed on insertPaul DuBois6 Jul