Wrong results of function age(timestamp, timestamp)
От | mmerta |
---|---|
Тема | Wrong results of function age(timestamp, timestamp) |
Дата | |
Msg-id | 1475676061981-5924559.post@n3.nabble.com обсуждение исходный текст |
Ответы |
Re: Wrong results of function age(timestamp, timestamp)
|
Список | pgsql-bugs |
Hello, I ecountered strange behaviour of function age(timestamp, timestamp). Let's say we have two timestamps and we want to compute their age() from fixed timestamp in past: SELECT pg_catalog.age('2016-04-30 00:00:01'::TIMESTAMP , '2015-01-01 12:00:00'::TIMESTAMP), pg_catalog.age('2016-04-29 23:59:59'::TIMESTAMP , '2015-01-01 12:00:00'::TIMESTAMP); age | age --------------------------------+-------------------------------- 1 year 3 mons 28 days 12:00:01 | 1 year 3 mons 28 days 11:59:59 Results are correct. If we add '1 day'::interval to original timestamps, both results should be 1 day longer. Howewer first result is exactly 24 hours longer than it should be: SELECT pg_catalog.age(('2016-04-30 00:00:01'::TIMESTAMP + '1 day'::INTERVAL), '2015-01-01 12:00:00'::TIMESTAMP), pg_catalog.age(('2016-04-29 23:59:59'::TIMESTAMP + '1 day'::INTERVAL), '2015-01-01 12:00:00'::TIMESTAMP); age | age --------------------------------+-------------------------------- 1 year 3 mons 30 days 12:00:01 | 1 year 3 mons 29 days 11:59:59 Am I missing something or is it a bug in function age(timestamp, timestamp)? I tested this on postgres versions 9.4.6 and 9.5.3 on CentOS 7, using timezone = 'Europe/Prague' in postgresql.conf. Regards Michal Merta -- View this message in context: http://postgresql.nabble.com/Wrong-results-of-function-age-timestamp-timestamp-tp5924559.html Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.
В списке pgsql-bugs по дате отправления: