Re: Division of intervals.
От | Joshua Moore-Oliva |
---|---|
Тема | Re: Division of intervals. |
Дата | |
Msg-id | 200303190103.50683.josh@chatgris.com обсуждение исходный текст |
Ответ на | Re: Division of intervals. (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Division of intervals.
|
Список | pgsql-general |
I guess that it does for this problem.. But I have other applications that require the number of days... and that gets a lot more complex to work out. Are there any plans in the near future to add this functionality? I had already through of this solution, but it appeared rather bulky to me, but I guess that's all there is now thanks. Josh. On March 19, 2003 12:23 am, Tom Lane wrote: > Joshua Moore-Oliva <josh@chatgris.com> writes: > > I attempted > > SELECT age(now(), timestamp '1957-06-13') / interval '1 month'; > > and got the error > > ERROR: Unable to identify an operator '/' for types 'interval' and > > 'interval' > > I'm not sure division of intervals is sensible --- consider the > recently-pointed-out issues about variable length of months, etc. > > Does this do what you want? > > regression=# SELECT extract(year from age(now(), timestamp '1957-06-13')); > date_part > ----------- > 45 > (1 row) > > regression=# SELECT extract(month from age(now(), timestamp '1957-06-13')); > date_part > ----------- > 9 > (1 row) > > regression=# SELECT extract(year from age(now(), timestamp '1957-06-13')) > *12 regression-# + extract(month from age(now(), timestamp '1957-06-13')); > ?column? > ---------- > 549 > (1 row) > > > regards, tom lane
В списке pgsql-general по дате отправления: