Re: INTERVAL representation

From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: Hackers List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: INTERVAL representation
Date: 2000-11-06 16:23:54
Message-ID: 20001106102354.A30863@rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 03, 2000 at 04:25:23PM +0000, Thomas Lockhart wrote:
> I've been working on date/time issues over the last few weeks (at least
> one or two from reports on the list, others that I've stumbled across,
> and even one or two planned ones ;)
>
<snip>
>
> Should we move to signed-only representations? Or retain the "ago"
> convention, having it match the sign of the first printed field, with
> subsequent fields having negative signs if they are positive values?
>
> At the moment, mixed-sign intervals are stored correctly (so have the
> right results for math) but are *not* represented in the output
> correctly.
>
> Possibilities are:
>
> '1 month -2 days ago' is less than a month ago.
> '1 month -2 days +03:04' is three hours more than two days less than a
> month from now.
> '-1 month +2 days' is less than a month ago.
>
> Comments?
>

Hmm, negative time values always force me to think twice. I guess I think of
time as a concrete thing, like a board: it has length, at to speak of a
negative length' makes little sense. Admittedly, time is inherently vectorial,
which other physical length measurements are not, requiring an arbitrarily
chosen point as reference.

Hmm, I started this reply planning on arguing that _keeping_ the 'ago'
was easiest on my ears. Now I find I've talked myself into losing it,
because it implies too much: 'ago' claims that that one end of the
interval is 'now' and the other end is in the past. If what you've got
is actually the difference between next Christmas and New Years:

template1=# select ('25/12/2000'::timestamp - '01/01/2001'::timestamp)
as "deadtime";

deadtime
-------------
7 00:00 ago
(1 row)

That seems just wrong.

Ross
--
Open source code is like a natural resource, it's the result of providing
food and sunshine to programmers, and then staying out of their way.
[...] [It] is not going away because it has utility for both the developers
and users independent of economic motivations. Jim Flynn, Sunnyvale, Calif.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-11-06 16:28:03 Re: problems with configure
Previous Message Martin A. Marques 2000-11-06 16:19:23 Re: problems with configure