# Pt-osc / MariaDB 11.4 - triggers on new table where DEFINER was role1 - created with DEFINER as user (role1@%)

**URL:** <https://forums.percona.com/t/pt-osc-mariadb-11-4-triggers-on-new-table-where-definer-was-role1-created-with-definer-as-user-role1/41213>\
**Category:** Percona Toolkit\
**Created:** [August 27, 2026, 9:37am UTC](https://forums.percona.com/t/pt-osc-mariadb-11-4-triggers-on-new-table-where-definer-was-role1-created-with-definer-as-user-role1/41213 "2026-08-27T09:37:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![psumner](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@psumner](https://forums.percona.com/u/psumner)\
**Post date:** [August 27, 2026, 9:37am UTC](https://forums.percona.com/t/pt-osc-mariadb-11-4-triggers-on-new-table-where-definer-was-role1-created-with-definer-as-user-role1/41213/1 "2026-08-27T09:37:26Z")

</div>

```auto
<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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![anil.joshi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/anil.joshi/32/13100_2.png) [@anil.joshi](https://forums.percona.com/u/anil.joshi)\
**Post date:** [August 27, 2026, 1:26pm UTC](https://forums.percona.com/t/pt-osc-mariadb-11-4-triggers-on-new-table-where-definer-was-role1-created-with-definer-as-user-role1/41213/2 "2026-08-27T13:26:36Z")

</div>

@psumner

I see this error irrespective of pt-osc operations while running a normal DML as well.

```auto
mysql> SET ROLE app_admin;

mysql> SELECT CURRENT_ROLE(); 
+-----------------+
| CURRENT_ROLE() |
+-----------------+
| `app_admin`@`%` |

```

```auto
mysql> UPDATE test.employees SET salary = 2222 WHERE name = 'test';
ERROR 1449 (HY000): The user specified as a definer ('CURRENT_ROLE'@'%') does not exist

```

With pt-osc as well, this is reproducible on tables with **DEFINER=CURRENT\_ROLE**.

It works fine when using the exact definer name e.g, **DEFINER = `app_admin`** instead of the **CURRENT\_ROLE**.

```auto
pt-online-schema-change \
  --alter "ADD INDEX (name)" \
  --user=root \
  --password="Root@1234" \
  --host=127.0.0.1 \
  --preserve-triggers \
  --port=3306 \
  D=test,t=employees \
  --execute

```

```auto
Altering new table...
Altered `test`.`_employees_new` OK.
2026-08-27T13:14:48 Creating triggers...
2026-08-27T13:14:48 Created triggers OK.
2026-08-27T13:14:48 Copying approximately 4 rows...
2026-08-27T13:14:48 Copied rows OK.
2026-08-27T13:14:48 Adding original triggers to new table.
2026-08-27T13:14:48 Analyzing new table...
2026-08-27T13:14:48 Swapping tables...
2026-08-27T13:14:48 Swapped original and new tables OK.
2026-08-27T13:14:48 Dropping old table...
2026-08-27T13:14:48 Dropped old table `test`.`_employees_old` OK.
2026-08-27T13:14:48 Dropping triggers...
2026-08-27T13:14:48 Dropped triggers OK.
Successfully altered `test`.`employees`.

```

```auto
mysql> INSERT INTO test.employees (name, salary) VALUES ('tt', 50000);
Query OK, 1 row affected (0.00 sec)

```

Are you sure that before the pt-osc operation, the DMLs are working properly on the same table without any such problems? Did you try any manual ones?

Can you please share the information below to match the role level details?

`mysql> SELECT trigger_name, definer FROM information_schema.triggers WHERE TRIGGER_NAME = '<TRIGGER_NAME>';`

`mysql> SELECT CURRENT_ROLE();`

`mysql> SELECT user, host FROM mysql.user WHERE user = '<ROLE_NAME>';`

`mysql> SHOW GRANTS FOR '<ROLE_NAME>' @'<HOST>';`

---

<div class="post-metadata">

**Author:** ![hai.nguyen](https://avatars.discourse-cdn.com/v4/letter/h/41988e/32.png) [@hai.nguyen](https://forums.percona.com/u/hai.nguyen)\
**Post date:** [September 21, 2026, 5:03am UTC](https://forums.percona.com/t/pt-osc-mariadb-11-4-triggers-on-new-table-where-definer-was-role1-created-with-definer-as-user-role1/41213/3 "2026-09-21T05:03:33Z")

</div>

Hi @psumner,

I tested and confirmed the issue you reported.

On MariaDB, `pt-online-schema-change --preserve-triggers` recreates existing table triggers with a `user@host` DEFINER. However, MariaDB roles are stored with an empty host. After the ALTER, `CREATE DEFINER=`role1` TRIGGER` becomes `CREATE DEFINER=`role1`@`%` TRIGGER`. Later INSERT/UPDATE/DELETE fails with:

```auto
ERROR 1449 (HY000): The user specified as a definer ('role1'@'%') does not exist

```

I have reported the issue here: [https://perconadev.atlassian.net/browse/PT-2563](https://perconadev.atlassian.net/browse/PT-2563)
