From: Jim C. Nasby <jnasby@pervasive.com>
To: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: Mark Dilger <pgsql@markdilger.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [SQL] Interval subtracting
Date: Wed, 1 Mar 2006 12:24:28 -0600
Message-ID: <20060301182428.GF82012@pervasive.com> (raw)
In-Reply-To: <200603011759.k21HxT320151@candle.pha.pa.us>
References: <4405D445.4000200@markdilger.com>
<200603011759.k21HxT320151@candle.pha.pa.us>
On Wed, Mar 01, 2006 at 12:59:29PM -0500, Bruce Momjian wrote:
> Good question. Should we restrict days to 0 - 30 or -30 - 30? The
> current system does the later:
>
> test=> select justify_days('-45 days');
> justify_days
> ------------------
> -1 mons -15 days
> (1 row)
>
> test=> select justify_days('1 month -45 days');
> justify_days
> --------------
> -15 days
> (1 row)
>
> test=> select justify_days('1 month -15 days');
> justify_days
> ----------------
> 1 mon -15 days
> (1 row)
>
> Should we be adjusting the last one? I am unsure. Comments?
ISTM it should be looking at the sign of the overall interval, and
sticking with that consistently. So while '1 mon 5 days' and '-3 mon -8
days' both make sense, '1 mon -2 days' doesn't make nearly as much sense
in the general case. Of course this is complicated by the fact that '1
mon 20 days' doesn't necessarily equate to '2 mon -10 days'... :(
One of these days we should just create a new calendar. ;)
--
Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461
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: jnasby@pervasive.com, pgman@candle.pha.pa.us, pgsql@markdilger.com, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
Subject: Re: [SQL] Interval subtracting
In-Reply-To: <20060301182428.GF82012@pervasive.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