![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
update mytable
set mycolumn = 1
where mycolumn = 0
;
Easy enough? No.
"Error Code: 1175. To disable safe mode, toggle the option in Preferences -> SQL Editor -> Query Editor and reconnect."
So I go there, and am told that safe mode prevents updates and deletes with no WHERE clause. A very good idea - but I've got a perfectly good Where clause, so what's the problem?
That error message has more than one line, and it's hard to even know the second is there to see. It says: "You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column"
A key column? Well, no... and there's no way I sensibly could, for this update.
I don't want to turn off safe mode completely, nor to start & stop. But a bit of Googling comes up with an answer.
SET SQL_SAFE_UPDATES=0;
Do update
SET SQL_SAFE_UPDATES=1;
set mycolumn = 1
where mycolumn = 0
;
Easy enough? No.
"Error Code: 1175. To disable safe mode, toggle the option in Preferences -> SQL Editor -> Query Editor and reconnect."
So I go there, and am told that safe mode prevents updates and deletes with no WHERE clause. A very good idea - but I've got a perfectly good Where clause, so what's the problem?
That error message has more than one line, and it's hard to even know the second is there to see. It says: "You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column"
A key column? Well, no... and there's no way I sensibly could, for this update.
I don't want to turn off safe mode completely, nor to start & stop. But a bit of Googling comes up with an answer.
SET SQL_SAFE_UPDATES=0;
Do update
SET SQL_SAFE_UPDATES=1;