Re: Interval->day proposal

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Glaesemann <grzm(at)myrealbox(dot)com>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Interval->day proposal
Date: 2005-06-01 14:31:07
Message-ID: 13781.1117636267@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Glaesemann <grzm(at)myrealbox(dot)com> writes:
> I've started working on this change, and one difference has shown up
> immediately in the regression tests. v8.0.3 currently returns:

> SELECT INTERVAL '10 years -11 month -12 days +13:14' AS "9 years...";
> 9 years...
> ----------------------------------
> ! 9 years 1 mon -11 days -10:46:00
> (1 row)

> With my first round of changes,

> SELECT INTERVAL '10 years -11 month -12 days +13:14' AS "9 years...";
> 9 years...
> ----------------------------------
> ! 9 years 1 mon -12 days +13:14:00
> (1 row)

Right, because it is now possible for day and hour to have different signs.
Comes with the territory I think.

> These are equivalent in both CVS and my branch, as '1 day'::interval
> = '24 hours'::interval. I haven't checked the SQL spec yet (and
> intend to do so), but is there a canonical form for intervals that we
> need to return?

AFAICS, the spec only allows one sign for the entire interval value,
so this behavior is already outside the spec. As long as we don't
generate different field signs in cases where that was not already
present in the input, I don't think it's a spec violation.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-06-01 14:36:40 Re: Can we simplify win32 threading code
Previous Message Tom Lane 2005-06-01 14:27:56 Re: Interval->day proposal