Re: BUG #1993: Adding/subtracting negative time intervals

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Nicholas Vinen <hb(at)x256(dot)org>
Cc: Klint Gore <kg(at)kgb(dot)une(dot)edu(dot)au>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Fuhr <mike(at)fuhr(dot)org>, Michael Glaesemann <grzm(at)myrealbox(dot)com>, Russell Smith <mr-russ(at)pws(dot)com(dot)au>, pgsql-bugs(at)postgresql(dot)org, Nicholas <hb(at)x256(dot)com>
Subject: Re: BUG #1993: Adding/subtracting negative time intervals
Date: 2005-10-26 03:17:05
Message-ID: 200510260317.j9Q3H5O27664@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Nicholas Vinen wrote:
>
> Thanks for all this discussion, fixing, etc. I'm currently having
> "issues" getting postgres' date/time functions to do what I want. You
> have obviously spotted some of the reasons for this.
>
> Many of my issues disappear when I use 8.1, but it's still in beta. Is
> it safe for me to use 8.1 in production, if I don't use any of the new

Not really, it is "beta".

> features? If not, would it be possible to backport these date/time
> changes to 8.0 so that my program can operate correctly before 8.1 is
> finished beta? I can do this backporting myself if someone can point me
> to the relevant files. (I'm sure I can work it out myself if necessary,
> but I'm a little busy at the moment).

Backporting is probably more dangerous than using 8.1 beta, unless you
are very careful and skillful. src/backend/utils/adt is where most of
the stuff lives.

> BTW, Postgres' date functions are *great* except for these minor
> problems. The best I've ever used.

It is really up to you how much risk you want to take for the features
you want.

---------------------------------------------------------------------------

>
>
> Thanks!
> Nicholas
>
>
> Klint Gore wrote:
>
> >On Tue, 25 Oct 2005 13:28:00 -0400, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >
> >
> >>regression=# select '2005-10-29 13:22:00-04'::timestamptz + '1 day'::interval;
> >> ?column?
> >>------------------------
> >> 2005-10-30 13:22:00-05
> >>(1 row)
> >>
> >>regression=# select '2005-10-30 13:22:00-05'::timestamptz - '2005-10-29 13:22:00-04'::timestamptz;
> >> ?column?
> >>----------------
> >> 1 day 01:00:00
> >>(1 row)
> >>
> >>ISTM that given the former result, the latter calculation ought to
> >>produce '1 day', not something else.
> >>
> >>
> >
> >Would the '1 day' result know it was 24 hours or be the new 23/24/25
> >hour version of '1 day'?
> >
> >If it was the new version, could you get the original values back?
> >i.e. what would be the result of
> >select
> >('2005-10-29 13:22:00-04'::timestamptz +
> >('2005-10-30 13:22:00-05'::timestamptz -
> > '2005-10-29 13:22:00-04'::timestamptz)) at time zone 'EST';
> >
> >klint.
> >
> >+---------------------------------------+-----------------+
> >: Klint Gore : "Non rhyming :
> >: EMail : kg(at)kgb(dot)une(dot)edu(dot)au : slang - the :
> >: Snail : A.B.R.I. : possibilities :
> >: Mail University of New England : are useless" :
> >: Armidale NSW 2351 Australia : L.J.J. :
> >: Fax : +61 2 6772 5376 : :
> >+---------------------------------------+-----------------+
> >
> >
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2005-10-26 03:41:54 Re: BUG #1993: Adding/subtracting negative time intervals
Previous Message Todd 2005-10-26 02:28:47 BUG #2000: psql does not prompt for password

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-10-26 03:23:10 Re: The use of (mb)print.c from psql in the scripts directory
Previous Message Tom Lane 2005-10-26 03:15:05 Re: Sequence dependencies