pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: 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 18:26:24 -0500 (EST)
Message-ID: <200603012326.k21NQOv08610@candle.pha.pa.us> (raw)
In-Reply-To: <440629DA.6050504@markdilger.com>

Mark Dilger wrote:
> Tom Lane wrote:
> > Well, the question is whether justify_days has a sane definition that is
> > different from this.  Based on your example, I'm not seeing one.
> 
> Backwards compatibility is probably more important than sanity.  Let's just 
> deprecate the existing functions and recommend that people use 
> justify_interval(...).  By not changing the existing functions we can avoid a 
> certain amount of hell.

Those functions are new in 8.1 so I do think we can improve them in 8.2
if we agree.  Tom's idea of:

>       * month > 0 and 0 <= day < 30
>       * month < 0 and -30 < day <= 0
>       * month = 0 and -30 < day < 30

seems a good change for 8.2, and the same for justify_hours(). The
question is whether justify_days should also adjust hours I think is the
issue, and the reason for a justify_interval() function.  Even if we had
people do:

	justify_hours(justify_days(justify_hours()))

I don't think that would do what we want in all cases.  Consider '1 mon
-1 hour'.  That should be '29 days 23 hours' but neither existing
function, even if modified, will allow us to return that.  Only
something like justify_interval() could do it.

-- 
  Bruce Momjian   http://candle.pha.pa.us
  SRA OSS, Inc.   http://www.sraoss.com

  + If your life is a hard drive, Christ can be your backup. +



view thread (62+ messages)  latest in thread

Message-ID: <200603012326.k21NQOv08610@candle.pha.pa.us>
Permalink:  ../200603012326.k21NQOv08610@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200603012326.k21NQOv08610@candle.pha.pa.us

 · 

reply

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: 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: <200603012326.k21NQOv08610@candle.pha.pa.us>

* 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