Skip site navigation (1) Skip section navigation (2)

Re: 8.3: timestamp subtraction

From: Ludwig Kniprath <ludwig(at)kni-online(dot)de>
To:
Cc: Pg - General <pgsql-general(at)postgresql(dot)org>
Subject: Re: 8.3: timestamp subtraction
Date: 2009-05-23 16:42:20
Message-ID: 4A18276C.8080504@kni-online.de (view raw or flat)
Thread:
Lists: pgsql-general
Scott Marlowe schrieb:
> On Sat, May 23, 2009 at 7:18 AM, Christophe <xof(at)thebuild(dot)com> wrote:
>   
>> On May 23, 2009, at 9:13 AM, Daniel Verite wrote:
>>     
>>>> I don't know why this query returns false:
>>>> SELECT '20040506 070809.010000'::timestamp(6) - '20010203
>>>> 040506.007000'::timestamp(6) = '1188 day 3 hour 3 minute 3 second 3
>>>> millisecond'::interval;
>>>> If I just subtract the two timestamps, its result is the interval I
>>>> specified.
>>>> What may cause this?
>>>>         
>>> It works for me:
>>>
>>> test=> SELECT '20040506 070809.010000'::timestamp(6) -
>>> '20010203 040506.007000'::timestamp(6)=
>>> '1188 day 3 hour 3 minute 3 second 3 millisecond'::interval;
>>> ?column? ----------
>>> t
>>> (1 row)
>>>       
>> Could this be due to the OP's build of PG using floating point timestamps?
>>     
>
> That's what I'm thinking
Me too, a testquery-result on a Windows-System with version "PostgreSQL 
8.3.0, compiled by Visual C++ build 1400":

SELECT ('20040506 070809.010000'::timestamp(6) - '20010203 
040506.007000'::timestamp(6) - '1188 day 3 hour 3 minute 3 second 3 
millisecond'::interval) * 1e10;

=> -00:01:28.220986

In response to

Responses

pgsql-general by date

Next:From: Steve AtkinsDate: 2009-05-23 17:03:12
Subject: Re: Asssociative Arrays: Best practices / snippets?
Previous:From: Scott MarloweDate: 2009-05-23 16:09:03
Subject: Re: 8.3: timestamp subtraction

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group