Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f75NJS623885 for ; Sun, 5 Aug 2001 19:19:28 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f75NJHY07215; Sun, 5 Aug 2001 19:19:17 -0400 (EDT) To: Allan Engelhardt cc: Josh Berkus , pgsql-sql@postgresql.org Subject: Re: Re: Data type confusion In-reply-to: <3B6DC695.599C2571@cybaea.com> References: <3B6DC695.599C2571@cybaea.com> Comments: In-reply-to Allan Engelhardt message dated "Sun, 05 Aug 2001 23:20:05 +0100" Date: Sun, 05 Aug 2001 19:19:17 -0400 Message-ID: <7212.997053557@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200108/54 X-Sequence-Number: 4275 Allan Engelhardt writes: > I don't think it makes conceptual sense to divide intervals.... It is kinda bogus, given the underlying semantics of intervals (integer months plus float seconds). The problem already arises for the existing interval * float8 and interval / float8 operators, though, so it'd be easy enough to make an interval / interval operator that is consistent with them. What those operators do is to convert any fractional-month result into seconds at an arbitrary conversion factor of 30 days to the month. For example, consider regression=# select '5 months 9 days'::interval; ?column? --------------- 5 mons 9 days (1 row) regression=# select '5 months 9 days'::interval * 0.5; ?column? ---------------------- 2 mons 19 days 12:00 (1 row) The initial product is effectively 2.5 months plus 4.5 days, and then we translate the .5 months into 15 days. This is pretty grotty, and AFAIK not documented anywhere --- I found it out by looking at the C code for these operators. But I'm not sure how to do better. regards, tom lane