--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database...@googlegroups.com.
To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.
Hi,
Hm, it's interesting, but I'm not quite sure if the change is worth it. What are the pain points?
> ability to clean up resources when a trigger is dropped (not just when the database is closed)
There are already method Trigger.remove() and Trigger.close(). Your interface only has close(). So it's actually one step back from what we have now?
> Simplified init() method
Well, in a way you added complexity by adding a class. But I see your point, having 6 parameters isn't all that great. But this change alone isn't worth the trouble I think. Changing the API needs to have a real, big benefit.
> Performance benefit for triggers that process multiple rows
Sorry what is the performance benefit? Also, do you have a benchmark?
> Ability to detect when triggers are fired by SELECT or ROLLBACK
Well, what would you pass when rolling back an update in the fire method: UPDATE or ROLLBACK? In fact both should be passed...
I am referring to the fact that currently if I want to process N rows, you need to create N * PreparedStatements (one per row inside fire()) as opposed to once at the beginning of the transaction. You are right that this needs to be benchmarked.
Hi,
> but that can lead to deadlocks ...> e.g. see this previous discussion:
As part of that discussion, I wrote: "I suggest to use PreparedStatement, and always create a new PreparedStatement (for each invokation of the trigger). Internally, the database caches a low-level part of a PreparedStatement,..."
So, I wonder if caching prepared statements is really a problem?
> I am under the impression that it doesn't matter whether a Trigger's resources get cleaned up due to the Trigger being dropped or the database being closed. Do you have a use-case that counters that?
The use case is: you might want to drop a table when the trigger is removed, but do nothing if the database is closed.
--
Hi,
In your test case, you didn't actually *execute* the statement. So it was "prepare a statement" versus "do nothing". Well, if the difference in time is so small, then I guess it doesn't make much sense to support this feature.
So, instead of continuing to discuss this back and forth, let's just keep the current trigger interface as it is, and whenever we do *have* to change it, then let's keep this discussion in mind. Specially, instead of passing 6 parameters, pass an object that contains that data (Metadata in your case). This was done in other places already: CreateTableData.
You received this message because you are subscribed to a topic in the Google Groups "H2 Database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/h2-database/Sb3T1aVwoCE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to h2-database...@googlegroups.com.
I believe this is caused by the fact that DEPARTMENTS has a ON
DELETE CASCADE constraint on the permissions table. The CASCADE
tries to lock DEPARTMENTS but the PreparedStatement (running in
the system connection) already has it locked. Using the system
connections from Trigger.init() lead to very ambiguous and
hard-to-debug failures :(
Anyway, I modified the PreparedStatement to use "SELECT *
FROM" instead of "DELETE FROM" to work around this issue.
So, in conclusion:
Action items:
Regards,Thomas
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscribe@googlegroups.com.
To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to a topic in the Google Groups "H2 Database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/h2-database/Sb3T1aVwoCE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to h2-database+unsubscribe@googlegroups.com.
To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscribe@googlegroups.com.
To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to a topic in the Google Groups "H2 Database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/h2-database/Sb3T1aVwoCE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to h2-database+unsubscribe@googlegroups.com.