time interval behaviour seems odd
От | Tilo Schwarz |
---|---|
Тема | time interval behaviour seems odd |
Дата | |
Msg-id | 200312172056.38376.mail@tilo-schwarz.de обсуждение исходный текст |
Ответы |
Re: time interval behaviour seems odd
|
Список | pgsql-hackers |
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 byGCC 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)
В списке pgsql-hackers по дате отправления: