Daniel Struck <struck(dot)d(at)retrovirology(dot)lu> writes:
> I think I have found a bug in postgresql:
I don't see any bug here; it's just that CHECK constraints are applied
after any BEFORE triggers are run. Since the triggers could change the
data to be inserted, the reverse order would be insecure.
regards, tom lane