Trigger Internals for Tables
We need to have Triggers on a variety of things:
1) Tables INSERT/UPDATE
2) Engine DDL
3) Commit
Today we essentially have #1 via the replication hooks. We need a way to expose these as a "service". Current idea is that when we create a TableShare we should add a vector of functions that should be run pre/post write_row(
For any sort of CREATE TRIGGER, the TRIGGER would be stored with the definition of the table (aka... DFE). Upon creation of the share any triggers, which are of a type function, would be pushed into the function vector to the table.
Open Question: DEFINER would be stored with DFE, how to assume credentials are safe (or do we just trust the engine?... gotta trust someone).
Open Question: Order. Does the order matter for the trigger? AKA should replication go before... or after?
Open Question: This system relies on the server side scripting, which means that our Trigger definition will require that a "language engine" be specified.
Open Question: API will need to be flexible enough to handle replication having access and other languages having access.
Open Question: Should Triggers require a specific form of function, or be more general in nature (aka... S^3 language will be for cal() but should it also provide for Triggers, or should we keep them different?)