<user>@<server>:~$ pt-online-schema-change --version
pt-online-schema-change 3.6.0
Recently ran pt-osc to add an index on a table which has after update/insert/delete triggers, all with DEFINER=role1
After successfully completing, users complained that they couldn’t insert to this table:
pymysql.err.OperationalError: (1449, “The user specified as a definer (‘role1’@‘%’) does not exist”)
Which is correct - that user doesn’t exist.
Because we run in RDS, we don’t have SUPER access and can’t just recreate with DEFINER=role1, we have to do it with set role role1 and definer=current_role
I was able to re-create all these triggers by logging in as a privileged user and running:
set role role1 ;
delimiter $$
CREATE OR REPLACE DEFINER=current_role .... AFTER UPDATE <trigger definition>
$$
CREATE OR REPLACE DEFINER=current_role .... AFTER DELETE <trigger definition>
$$
CREATE OR REPLACE DEFINER=current_role .... AFTER INSERT <trigger definition>
$$
delimiter ;
I don’t see this listed as a limitation or any documentation on how to manage this this issue, so I assume pt-osc isn’t aware of the concept that DEFINER can be a role in MariaDB.