Description:
INSERT ... ON DUPLICATE KEY UPDATE ...
on a table with a primary key requires UPDATE (not just INSERT)
access to the primary key columns, even though the UPDATE half
of the statement doesn't attempt to update them.
This is inconvenient if one wants a table whose primary keys are
to be immutable once set.
How to repeat:
CREATE TABLE t1 (k1 varchar(10) primary key, v1 varchar(10));
GRANT select,insert(k1,v1),update(v1) ON TABLE t1 TO user1;
(then as user1)
INSERT INTO t1(k1,v1) VALUES('key','value')
ON DUPLICATE KEY UPDATE v1='value';
This fails if the only relevant grants to user1 are as above.
Description: INSERT ... ON DUPLICATE KEY UPDATE ... on a table with a primary key requires UPDATE (not just INSERT) access to the primary key columns, even though the UPDATE half of the statement doesn't attempt to update them. This is inconvenient if one wants a table whose primary keys are to be immutable once set. How to repeat: CREATE TABLE t1 (k1 varchar(10) primary key, v1 varchar(10)); GRANT select,insert(k1,v1),update(v1) ON TABLE t1 TO user1; (then as user1) INSERT INTO t1(k1,v1) VALUES('key','value') ON DUPLICATE KEY UPDATE v1='value'; This fails if the only relevant grants to user1 are as above.