From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Richard Yen <richyen3(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: CHECK constraint fails when it's not supposed to |
Date: | 2009-08-04 18:59:12 |
Message-ID: | 19212.1249412352@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Richard Yen <richyen3(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2009-08-04 19:24:33 | Re: timestamp with time zone, retrieving input offset/timezone |
Previous Message | Pavel Stehule | 2009-08-04 18:47:09 | Re: Error when assigning default value for function parameter |