Re: CHECK constraints inconsistencies - Mailing list pgsql-hackers

From Bruno Wolff III
Subject Re: CHECK constraints inconsistencies
Date
Msg-id 20040302014359.GA24170@wolff.to
Whole thread Raw
In response to Re: CHECK constraints inconsistencies  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: CHECK constraints inconsistencies
List pgsql-hackers
On Mon, Mar 01, 2004 at 20:28:02 -0500, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Michael Glaesemann <grzm@myrealbox.com> 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.


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Avoid MVCC using exclusive lock possible?
Next
From: Curt Sampson
Date:
Subject: Re: Check Constraints and pg_dump