From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Milen A. Radev <milen@radev.net>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: [SQL] Interval subtracting
Date: Sat, 18 Feb 2006 11:03:39 -0800 (PST)
Message-ID: <20060218110129.W9818@megazone.bigpanda.com> (raw)
In-Reply-To: <20402.1140287414@sss.pgh.pa.us>
References: <200602181444.06009.milorad.poluga@cores.co.yu>
<43F72E27.2060408@radev.net>
<200602181536.20605.milorad.poluga@cores.co.yu>
<43F7330E.1060907@radev.net>
<20402.1140287414@sss.pgh.pa.us>
On Sat, 18 Feb 2006, Tom Lane wrote:
> "Milen A. Radev" <milen@radev.net> writes:
> > Milorad Poluga напиÑа:
> >>> SELECT '10 years 1 mons 1 days'::interval - '9 years 10 mons 15 days'::interval
> >>> ?column?
> >>> ---------------
> >>> 3 mons -14 days
> >>>
> >>> Why not '2 mons 16 days' ?
>
> > Please read the last paragraph in section 8.5.1.4 of the manual
> > (http://www.postgresql.org/docs/8.1/static/datatype-datetime.html#AEN4775)
> > . It mentions the functions named "justify_days" and "justify_hours"
> > that could do what you need.
>
> justify_days doesn't currently do anything with this result --- it
> thinks its charter is only to reduce day components that are >= 30 days.
> However, I think a good case could be made that it should normalize
> negative days too; that is, the invariant on its result should be
> 0 <= days < 30, not merely days < 30.
What about cases like interval '1 month -99 days', should that turn into
interval '-3 mons +21 days' or '-2 mons -9 days'?
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sszabo@megazone.bigpanda.com, tgl@sss.pgh.pa.us, milen@radev.net, pgsql-hackers@postgresql.org
Subject: Re: [SQL] Interval subtracting
In-Reply-To: <20060218110129.W9818@megazone.bigpanda.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox