| From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> | 
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
| Cc: | pgsql-hackers(at)postgresql(dot)org | 
| Subject: | Re: roundoff problem in time datatype | 
| Date: | 2005-10-13 20:48:01 | 
| Message-ID: | 200510132048.j9DKm1g08373@candle.pha.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers pgsql-patches | 
Where are we on this?  I see current CVS behaving the same as below,
except the last query now returns 24:00:00.
---------------------------------------------------------------------------
Tom Lane wrote:
> Inserting into a time field with limited precision rounds off, which
> is good except for this case:
> 
> regression=# select '23:59:59.9'::time(0);
>    time   
> ----------
>  24:00:00
> (1 row)
> 
> This is bad because:
> 
> regression=# select '24:00:00'::time(0);
> ERROR:  date/time field value out of range: "24:00:00"
> 
> which means that data originally accepted will fail to dump and reload.
> 
> I see this behavior in all versions back to 7.3.  7.2 was even more
> broken:
> 
> regression=# select '23:59:59.9'::time(0);
>    time   
> ----------
>  00:00:00
> (1 row)
> 
> I think the correct behavior has to be to check for overflow again
> after rounding off.  Alternatively: why are we forbidding the value
> 24:00:00 anyway?  Is there a reason not to allow the hours field
> to exceed 23?
> 
> 			regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
> 
-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2005-10-13 20:53:16 | Re: roundoff problem in time datatype | 
| Previous Message | Bruce Momjian | 2005-10-13 20:42:22 | Re: Request for a "force interactive mode" flag (-I) for psql | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2005-10-13 20:48:36 | Re: COPY view | 
| Previous Message | Tom Lane | 2005-10-13 19:46:43 | Re: [HACKERS] Kerberos brokenness and oops question in 8.1beta2 |