- 积分
- 39
- UID
- 15225
- 阅读权限
- 10
- 注册时间
- 2014-2-7
- 精华
- 在线时间
- 小时
- 最后登录
- 1970-1-1
- 职业
- 1
|
简要来说,就是某字段column_a在插入记录时没有赋值,之后就没法更新了。
具体如下:
两列的create table命令如下:
`column_a` int(18) DEFAULT '100' COMMENT '无法update',
`column_b` int(18) DEFAULT '0' COMMENT '可以update',
我插入一条数据,column_a没有赋值,column_b=123
insert table_name (column_b) values (123);
然后我发现该问题,想要更新column_a值,结果出错:
update table_name set column_a = 123213 where id = 1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'column_a = 123213 where id = 1' at line 1
查询该记录column_a = 100, column_b = 123。
不知道什么原因,于是我写入column_b,发现column_b可以正常更新:
update table_name set column_b = 123213 where id = 1;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0
着实奇怪。。
mysql版本如下:
Server version: 5.1.54-1ubuntu4-log (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
|
|