Richard Yen <richyen3@gmail.com> writes:
> When I run my update, it fails:
>> tii=# begin; update only "public"."m_class" set date_end='2009-09-03
>> 05:38:24.030331-07',term_length='177 days 17:59:09.868431' where
>> id='2652020';
>> BEGIN
>> ERROR: new row for relation "m_class" violates check constraint
>> "end_within_term_length"
>> tii=# rollback;
Hmm, I get this:
regression=# select '2009-03-09 11:39:14.1619-07'::timestamptz + '177 days 17:59:09.868431'::interval;
?column?
-------------------------------
2009-09-03 05:38:24.030331-07
(1 row)
which is apparently exactly the same as your date_end value, but I bet
it's not quite the same after allowing for floating-point roundoff error.
If this database wasn't built with the exact-integer-timestamps option
then you can't assume that timestamp calculations are exact to the
microsecond.
regards, tom lane