|
|
|
|
|
by gsvigruha
2866 days ago
|
|
Interesting, which DB is that? The ones i checked only have constraints on one table at a time (besides foreign keys). The idea here is that constraints could span across multiple tables via chains of foreign keys. It might not be a new idea but i haven't seen any implementations yet (unless you count triggers). |
|
transfer_table(id, user, src, dest, amnt), amnt > 10000.0 -> auth_table(id, man), managed_by_table(user, man).
If you wanted to express that for a transfer involving more than 10,000 dollars that it must have been approved by the user's manager. Basically any logical formula can be used as a constraint. It's also possible to express basic temporal constraints like
+user_pass_table(user, pswd1), user_pass_table@prev(user, pswd2) -> pswd1 != pswd2.
So that says if the user's password has changed, and the user had a password in the previous transaction, they cannot be the same password.