[odb-users] postgres constraints (or triggers)
Boris Kolpackov
boris at codesynthesis.com
Tue Feb 4 07:44:26 EST 2025
MM <finjulhich at gmail.com> writes:
> I wish to ensure that the sum of a column across all rows always equals
> 100%. Currently I ensure that at the application level before persistence.
> postgresql CHECK constraint doesn't work for this but I believe a TRIGGER
> may work before insert/update. There's no odb support for that is there?
There is no ODB support for creating triggers but I don't think anything
prevents you from creating one manually yourself.
> Is it the advice to keep at user code in the application instead?
There are different schools of thought on this: Some think that any
processing that can be performed on the client side should be done
there to reduce the load on the database. Others think it is better
to perform it on the database in order to enforce consistent behavior.
More information about the odb-users
mailing list