Hi,

while trying to create a query this afternoon dealing with intervals, I 
noticed the following behaviour and I wondered, if it is intended. (It was 
non-intuitive to me and if there was a warning in the docs i missed it.)
The lines marked   <---   make me wonder ...

tschwarz=> select version();
                                version
------------------------------------------------------------------------
 PostgreSQL 7.3.2 on i386-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.3
(1 row)

tschwarz=> select '1'::interval;
 interval
----------
 00:00:01
(1 row)

tschwarz=> select -'1'::interval;
 ?column?
-----------
 -00:00:01
(1 row)

tschwarz=> select '-1'::interval;
 interval
----------
 -01:00        <---
(1 row)

tschwarz=> select -'-1'::interval;
 ?column?
----------
 01:00        <---
(1 row)


Now with 1.0 everything looks fine:


tschwarz=> select '1.0'::interval;
 interval
----------
 00:00:01
(1 row)

tschwarz=> select -'1.0'::interval;
 ?column?
-----------
 -00:00:01
(1 row)

tschwarz=> select '-1.0'::interval;
 interval
-----------
 -00:00:01
(1 row)

tschwarz=> select -'-1.0'::interval;
 ?column?
----------
 00:00:01
(1 row)


But look at 0.1:


tschwarz=> select '0.1'::interval;
  interval
-------------
 00:00:00.10
(1 row)

tschwarz=> select -'0.1'::interval;
   ?column?
--------------
 -00:00:00.10
(1 row)

tschwarz=> select '-0.1'::interval;
  interval
-------------
 00:00:00.10   <---
(1 row)

tschwarz=> select -'-0.1'::interval;
   ?column?
--------------
 -00:00:00.10   <---
(1 row)


---------------------------(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