Re: timestamp arithmetic (a possible bug?)

From: Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: Ilir Gashi <I(dot)Gashi(at)city(dot)ac(dot)uk>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: timestamp arithmetic (a possible bug?)
Date: 2004-07-02 10:46:46
Message-ID: Pine.LNX.4.44.0407021335190.11763-100000@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

O kyrios Ilir Gashi egrapse stis Jul 2, 2004 :

SELECT '01.01.2004 10:00:00'::timestamp + ('01.01.2004
10:01:00'::timestamp - '01.01.2004 10:00:00'::timestamp)::interval;
?column?
---------------------
2004-01-01 10:01:00
(1 row)

works fine in my 7.4.2

> Hi,
>
> I saw this behaviour in PostgreSQL 7.2. (Once again, I know this is an old
> release but I do not have a newer version installed, and I am only using
> the server for research purposes). If you execute the following statement
>
> SELECT (CAST('01.01.2004 10:01:00' AS TIMESTAMP) - CAST('01.01.2004
> 10:00:00' AS TIMESTAMP)) + CAST('01.01.2004 10:00:00' AS TIMESTAMP);
>
> The result returned is:
>
> ?column?
> ---------------------
> 2004-01-01 00:01:00
> (1 row)
>
> I was expecting: 2004-01-01 10:01:00.
>
> Tried it on Oracle 8.0.5:
>
> SELECT TO_DATE('01.01.2004 10:01:00', 'DD.MM.YYYY HH:MI:SS') -
> TO_DATE('01.01.2004 10:00:00', 'DD.MM.YYYY HH:MI:SS') + TO_DATE('01.01.2004
> 10:00:00', 'DD.MM.YYYY HH:MI:SS') FROM DUAL;
>
> ---------------------------
> 2004-01-01 10:01:00
> (1 row selected)
>
>
> And MSSQL 7:
>
> SELECT (CAST('01.01.2004 10:01:00' AS DATETIME) - CAST('01.01.2004
> 10:00:00' AS DATETIME) + CAST('01.01.2004 10:00:00' AS DATETIME));
>
>
> ---------------------------
>
> 2004-01-01 10:01:00.000
>
> (1 row(s) affected)
>
>
> Is this a bug? Same thing happens if I use TimestampTZ rather than
> Timestamp.
>
> Best regards,
>
> Ilir
>
> ____________________________________________
>
> Ilir Gashi
> PhD Student
> Centre for Software Reliability
> City University
> Northampton Square, London EC1V 0HB
> email: i(dot)gashi(at)city(dot)ac(dot)uk
> website: http://www.csr.city.ac.uk/csr_city/staff/gashi/
> ____________________________________________
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

--
-Achilleus

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Ilir Gashi 2004-07-02 10:54:10 timestamp arithmetic (a possible bug?)
Previous Message Ilir Gashi 2004-07-02 10:38:28 Re: Possible bug?