I am building a database application that uses functions and triggers. One trigger I have limits the possible data that can be put in on INSERT
to make sure a record goes through a defined set of states. However, there is a function that inserts a record in that table that fires that trigger (it starts in a different state).
My question now, is it OK to disable that trigger using ALTER TABLE
in that function to get this working, or should I rethink my trigger design? Another work around would be to insert it in the "start" state and immediately UPDATE
the record to make a state-step.