Re: [BUGS] BUG #14632: Plus and minus operators inconsistency with leap years and year intervals.

Поиск
Список
Период
Сортировка
От Pietro Pugni
Тема Re: [BUGS] BUG #14632: Plus and minus operators inconsistency with leap years and year intervals.
Дата
Msg-id FDFDA51E-CE35-4C7A-B4D8-3EB6BDF88153@gmail.com
обсуждение исходный текст
Ответ на Re: [BUGS] BUG #14632: Plus and minus operators inconsistency with leap years and year intervals.  (Pietro Pugni <pietro.pugni@gmail.com>)
Список pgsql-bugs
Probably it should be worth it to implement a sort of age2(timestamp, timestamp) function that returns ages accounting for leap years, months, days and seconds, without changing the actual implementation of age(timestamp, timestamp).

This results also may be of interest:

1)
select age('2007-04-01'::date, '1917-04-01'::date);
                age                
-----------------------------------
 89 years 11 mons 29 days 23:00:00

2)
select age('2007-04-01'::timestamp without time zone, '1917-04-01'::timestamp without time zone);
   age    
----------
 90 years


3)
select age('2007-04-01'::timestamp without time zone, '1917-04-01'::date);
   age    
----------
 90 years

4)
select age('2007-04-01'::date, '1917-04-01'::timestamp without time zone);
   age    
----------
 90 years


I don’t know if the result of query 1) is the desired output of the age(timestamp, timestamp) function.
Casting to timestamp and all combinations of date provides the same result as queries 2), 3) and 4):

5)
select age('2007-04-01'::timestamp, '1917-04-01'::timestamp);
   age    
----------
 90 years

6)
select age('2007-04-01'::date, '1917-04-01'::timestamp);
   age    
----------
 90 years

7)
select age('2007-04-01'::timestamp, '1917-04-01'::date);
   age    
----------
 90 years


Is there a reason for 1) being different in respect of the other queries?


Kind regards,
 Pietro Pugni

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Pietro Pugni
Дата:
Сообщение: Re: [BUGS] BUG #14632: Plus and minus operators inconsistency with leap years and year intervals.
Следующее
От: Pedro Gimeno
Дата:
Сообщение: [BUGS] Re: BUG #14632: Plus and minus operators inconsistency with leapyears and year intervals.