pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: Mark Dilger <pgsql@markdilger.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [SQL] Interval subtracting
Date: Wed, 01 Mar 2006 15:28:11 -0500
Message-ID: <14834.1141244891@sss.pgh.pa.us> (raw)
In-Reply-To: <200603012013.k21KDFM21139@candle.pha.pa.us>
References: <200603012013.k21KDFM21139@candle.pha.pa.us>

Bruce Momjian <pgman@candle.pha.pa.us> writes:
> I don't think we can accept a change that takes a negative and turns it
> into a positive and negative.

Yeah, I find the patch's changes to the regression results pretty
disturbing.

Perhaps the correct definition ought to be like "if month part >= 0
then the reduced day part should be between 0 and 30, otherwise the
reduced day part should be between 0 and -30".  However there are
still corner cases to worry about.  If the original month and day
parts are of different sign, you might not be able to do such a
reduction without changing the sign of the month part, consider
"1 month -95 days".  Not clear what to do with this.

I guess I would expect a good result to satisfy one of these three
cases:
	* month > 0 and 0 <= day < 30
	* month < 0 and -30 < day <= 0
	* month = 0 and -30 < day < 30
If you believe that then "1 month -95 days" should justify to
"-2 months -5 days".

			regards, tom lane



view thread (62+ messages)  latest in thread

Message-ID: <14834.1141244891@sss.pgh.pa.us>
Permalink:  ../14834.1141244891@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/14834.1141244891@sss.pgh.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: tgl@sss.pgh.pa.us, pgman@candle.pha.pa.us, pgsql@markdilger.com, pgsql-hackers@postgresql.org
  Subject: Re: [SQL] Interval subtracting
  In-Reply-To: <14834.1141244891@sss.pgh.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