From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Gary Chambers <gwchamb(at)gwcmail(dot)com> |
Cc: | Ben Chobot <bench(at)silentmedia(dot)com>, Allen Chen <rocklob(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Inconsistent time interval formatting |
Date: | 2011-01-13 19:03:20 |
Message-ID: | 20838.1294945400@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Gary Chambers <gwchamb(at)gwcmail(dot)com> writes:
>>> Why do some of the intervals show days broken out whereas others only
>>> show hours? I have seen intervals left in hours even when the intervals
>>> are more than two days long. FWIW, I would prefer if it was always left
>>> in hours, but would be happy if it would just be consistent either way.
>> I have the same issue on 8.4. Fixing it is low on my task list, but I too
>> would like to know why.
> An interim fix might be to cast your output to interval(0) (or to whatever
> degree of precision you might need). I believe I encountered this behavior
> some time ago and casting solved the problem for me.
That won't really help. The fundamental point here is that '1 day' is
not the same concept as '24 hours', because of DST changes; and the
interval type treats them as different.
If you don't care about that, you can use justify_hours (I think that's
the right function) to smash them to the same thing.
But I suspect the OP's real complaint would be better solved by use of
to_char() to produce an output format that includes zeroes instead of
dropping fields that are zero.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Alban Hertroys | 2011-01-13 19:09:13 | Re: Record with a field consisting of table rows |
Previous Message | John R Pierce | 2011-01-13 18:48:13 | Re: Inconsistent time interval formatting |