On Mon, Mar 01, 2004 at 20:28:02 -0500, Tom Lane <[EMAIL PROTECTED]> wrote: > Michael Glaesemann <[EMAIL PROTECTED]> writes: > > In both cases, the CHECK constraint uses a function that is stable or > > volatile. It was suggested that functions used in CHECK constraints be > > restricted to immutable, > > This seems reasonable to me. I'm a bit surprised we do not have such a > check already.
There may be times you want to do this. For example you may want a timestamp to be in the past. In this case as long as it was in the past when the data was entered it will continue to be in the past (barring someone resetting the system time). This is something someone might actually check unlike comparing to random numbers. I think just noting that check constraints are only checked on inserts and updates and that this means that check constraints using volatile or stable functions need to be well thought out. ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster