# Pt-online-schema-change failing for a table with triggers

**URL:** <https://forums.percona.com/t/pt-online-schema-change-failing-for-a-table-with-triggers/34586>\
**Category:** Other MySQL® Questions\
**Created:** [October 25, 2024, 4:49am UTC](https://forums.percona.com/t/pt-online-schema-change-failing-for-a-table-with-triggers/34586 "2024-10-25T04:49:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![md.abrarh](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@md.abrarh](https://forums.percona.com/u/md.abrarh)\
**Post date:** [October 25, 2024, 4:49am UTC](https://forums.percona.com/t/pt-online-schema-change-failing-for-a-table-with-triggers/34586/1 "2024-10-25T04:49:59Z")

</div>

Hi,

I am trying to add an index to a table which already has two triggers (INSERT and UPDATE)…Now I am using --preserve-triggers to preserve the eisting triggers on new table but still getting below error.  
““Check if all fields referenced by the trigger still exists after the operation you are trying to apply at /usr/local/Cellar/percona-toolkit/3.5.5/libexec/bin/pt-online-schema-change line 11558.””

Our MySQL version is 8.0.32 and Aurora version is 3.05.2.

Command used :  
pt-online-schema-change --recursion-method=none --chunk-size=100000 --max-load Threads\_running=300 --critical-load Threads\_running=1000 --alter-foreign-keys-method=auto --alter=“ADD INDEX \<Index\_name\> (row\_stamp)” h=“XXXXXXXXXXX”,P=3306,u=${PTOSC\_USER},p=“${PTOSC\_PASSWORD}”,D=XXXXXXXX,t=XXXXXXXX --print --pause-file /tmp/pause-file --preserve-triggers --dry-run

I checked the existing triggers on table and the columns in both the triggers are same…Here is the trigger definition :

CREATE DEFINER=`xxxxxxxx`@`%` TRIGGER `mysqldb`.`ohgdrsxozvltfmh` AFTER UPDATE ON \_actual\_cash\_new  
FOR EACH ROW  
INSERT INTO actual\_cash\_history (  
cash\_flow\_id,  
created\_at,  
changed\_on,  
public\_id,  
currency,  
amount,  
amount\_scale,  
account\_id,  
execution\_time,  
capture\_time,  
settlement\_time,  
cancellation\_time,  
estimated\_settlement\_time,  
earliest\_settlement\_time,  
latest\_settlement\_time,  
business\_transaction\_type,  
business\_transaction\_public\_id,  
algorithm\_version,  
collision\_hash,  
content\_hash,  
forecasted\_settlement\_time,  
cash\_flow\_type  
)  
SELECT  
acf.cash\_flow\_id,  
acf.created\_at,  
NOW(),  
acf.public\_id,  
acf.currency,  
acf.amount,  
acf.amount\_scale,  
acf.account\_id,  
acf.execution\_time,  
acf.capture\_time,  
acf.settlement\_time,  
acf.cancellation\_time,  
acf.estimated\_settlement\_time,  
acf.earliest\_settlement\_time,  
acf.latest\_settlement\_time,  
acf.business\_transaction\_type,  
acf.business\_transaction\_public\_id,  
acf.algorithm\_version,  
acf.collision\_hash,  
acf.content\_hash,  
acf.forecasted\_settlement\_time,  
acf.cash\_flow\_type  
FROM actual\_cash AS acf  
WHERE acf.cash\_flow\_id = NEW.cash\_flow\_id"] at /usr/local/Cellar/percona-toolkit/3.5.5/libexec/bin/pt-online-schema-change line 11552.

Any help will be greatly appreciated…

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [October 25, 2024, 12:18pm UTC](https://forums.percona.com/t/pt-online-schema-change-failing-for-a-table-with-triggers/34586/2 "2024-10-25T12:18:32Z")

</div>

> [@md.abrarh](#):
>
> add an index to a table

You don’t need pt-osc for adding indexes. ADD INDEX is already an online, non-blocking background operation. Adding the index with a normal ALTER TABLE will not block other writers.
