3

something like:

CREATE TRIGGER
       schema1.triggername
AFTER INSERT ON schema2.table
FOR EACH ROW
BEGIN
       ;
END;

ERROR 1435 (HY000): Trigger in wrong schema

1 Answer 1

3

The trigger needs to be in the same schema as the table you are inserting to, but it can access tables in other schemas.

Using your example:

CREATE TRIGGER schema2.triggername
AFTER INSERT ON schema2.the_table
FOR EACH ROW
  INSERT INTO schema1.the_table values (...);
Sign up to request clarification or add additional context in comments.

2 Comments

yes, thanks but I want the trigger (all the triggers actually) in a different schema than the tables.
this fixed my error after using create trigger schema2.triggername

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.