On Jul 2 2004, Achilleus Mantzios wrote:

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

Yes. I've just tried it in PostgreSQL 7.2 and it works fine there as well.



On Jul 2 2004, Theodore Petrosky wrote:

Interesting....

If I reverse the order it works...

agencysacks=# SELECT CAST('01.01.2004 10:00:00' AS
TIMESTAMP) + (CAST('01.01.2004 10:01:00' AS TIMESTAMP)
- CAST('01.01.2004 10:00:00' AS TIMESTAMP)) as answer;
answer ---------------------
2004-01-01 10:01:00
(1 row)

Yes. The above works for me as well in 7.2.




However your original...


agencysacks=# 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); ERROR: operator does not exist: interval + timestamp without time zone HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.


agencysacks=# select version();
version -------------------------------------------------------------------------------------------------------------------------
PostgreSQL 7.4.2 on powerpc-apple-darwin7.2.0,
compiled by GCC gcc (GCC) 3.3 20030304 (Apple
Computer, Inc. build 1495)
(1 row)


Looks like postgresql demands the order to be timestamp +- interval.

Ted

I am not getting the error above. I get the incorrect result as reported in my original report. Does this mean that this was a buggy behaviour in 7.2 and then was changed in the latter releases to give the error message that 7.4.2 is giving?


Thanks for the quick responses.

Best regards,

Ilir
____________________________________________

Ilir Gashi PhD Student Centre for Software Reliability City University Northampton Square, London EC1V 0HB
email: [EMAIL PROTECTED]
website: http://www.csr.city.ac.uk/csr_city/staff/gashi/
____________________________________________



---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly

Reply via email to