我知道我可以关闭MySQL中的安全模式,所以我不想尝试解决这个问题。
我有一张简单的桌子:
create table rubbish(
id int auto_increment primary key,
stuff text,
nonsense text
);
在这里
id
是主键。
打开安全模式后,我尝试以下操作:
update rubbish set nonsense=stuff where id=id; -- fails
update rubbish set nonsense=stuff where id is not null; -- fails
update rubbish set nonsense=stuff where id<>0; -- works
与MySQL中的大多数错误消息一样,错误消息是无用的:
You are using safe update mode and you tried to update
a table without a WHERE that uses a KEY column
在所有情况下,我都使用键列,因此消息无法解释任何内容。MySQL实际上要求我如何处理键列?