We throw an error if the expression in a CREATE INDEX statement is not IMMUTABLE.
But while the documentation notes that expressions in CHECK constraints are not
to be immutable, we don't enforce that. Why don't we call something like
CheckMutability inside cookConstraint? Sure, that wouldn't catch all abuse,
but it would be better than nothing.
There is of course the worry of breaking upgrade for unsafe constraints, but is
there any other reason not to enforce immutability?
Yours,
Laurenz Albe