0
update profiles_profiles set unconfirmed_phone=2222222222 where id = 1;


mysql> select * from profiles_profiles\G
*************************** 1. row ***************************
               id: 1
          user_id: 1
            phone: NULL
unconfirmed_phone: 2147483647

出于某种原因,我的更新不适用于“2222222222”。但是,它适用于 1111111111。

MySQL 总是更新所有其他字段,但它每次都将 unconfirmed_phone 更改为 2147483647。

mysql> desc profiles_profiles;
+-------------------+----------+------+-----+---------+----------------+
| Field             | Type     | Null | Key | Default | Extra          |
+-------------------+----------+------+-----+---------+----------------+
| id                | int(11)  | NO   | PRI | NULL    | auto_increment |
| user_id           | int(11)  | NO   | UNI | NULL    |                |
| phone             | int(11)  | YES  | UNI | NULL    |                |
| unconfirmed_phone | int(11)  | YES  |     | NULL    |                |


*************************** 8. row ***************************
           Name: products_products
         Engine: InnoDB
        Version: 10
     Row_format: Compact
           Rows: 0
 Avg_row_length: 0
    Data_length: 16384
Max_data_length: 0
   Index_length: 16384
      Data_free: 5242880
 Auto_increment: 1
    Create_time: 2013-04-11 05:23:31
    Update_time: NULL
     Check_time: NULL
      Collation: utf8_general_ci
       Checksum: NULL
 Create_options: 
        Comment: 
4

1 回答 1

3

这只是意味着您要更新当前值的新值只是溢出了。signed int的最大允许值为2147483647

有时电话号码的数据类型可能只是varchar因为其他人用符号保存它(, ), -

摘自手册,

最大值取决于系统。32 位系统的最大有符号整数范围为 -2147483648 到 2147483647。例如,在这样的系统上,intval('1000000000000') 将返回 2147483647。64 位系统的最大有符号整数值为 9223372036854775807。

于 2013-04-11T05:44:10.033 回答