Error creating or initializing trigger

215 views
Skip to first unread message

Volk

unread,
Feb 11, 2008, 8:30:38 AM2/11/08
to H2 Database
Hello, Thomas.
I created my own trigger (class), added it to database and deleted
trigger class from my application. After that I can't delete trigger
from schema, because it wasn't created, and at the same time I get
"org.h2.jdbc.JdbcSQLException: Error creating or initializing trigger
MY_TRIGGER object" when I tried to

So I had to add trigger class to application again, delete it from
schema, and again delete from application.
Another way is deleting trigger from INFORMATION_SCHEMA.TRIGGERS, but
isn't it a hack?
What is the right way to overcome this case?

Regards,
Kirill Volgin.

Thomas Mueller

unread,
Feb 11, 2008, 2:29:52 PM2/11/08
to h2-da...@googlegroups.com
Hi,

Thanks for your help! You are right, it's a bit tricky to get rid of the trigger. Also, you might not notice the trigger class is missing, because you can connect to the database (the exception is only in the log file) and insert data (or whatever action the trigger is defined on). I think the trigger should be created at startup even if the class is missing, but when trying to insert data (or update,...), an exception should be thrown saying the trigger class was not found. And it should be allowed to drop the trigger normally. This is the behavior of Java functions. I will try to implement this in the next release.

> deleting trigger from INFORMATION_SCHEMA.TRIGGERS

You can't for two reasons: meta data tables are not updatable, and the trigger is not there.

Regards,
Thomas
Reply all
Reply to author
Forward
0 new messages