Sorry for weird title, don’t know how to name the Q better. So:
I have 3 tables. EntityA, EntityB, AB. The classical many-to-many implementation.
Is there any possibility to create constraint that mandates ALWAYS to have at least one relation between A and B.
Example workflow:
a) Insert A, Insert B, insert relation, commit; SUCCESS
b) Insert A, Insert B, commit; FALSE
So the question is: is there any on commit trigger? Or something similar to.
There is no such thing as an ON COMMIT trigger. However, you can generally simulate the behavior of an ON COMMIT trigger using materialized views. In your case, you could
When you commit, the materialized view refresh takes place. If a constraint on the materialized view fails, the commit fails.