Re: BUG #1993: Adding/subtracting negative time intervals - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: BUG #1993: Adding/subtracting negative time intervals
Date
Msg-id 200510260317.j9Q3H5O27664@candle.pha.pa.us
Whole thread Raw
List pgsql-bugs
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@sss.pgh.pa.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@kgb.une.edu.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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-bugs by date:

Previous
From: Klint Gore
Date:
Subject: Re: BUG #1993: Adding/subtracting negative time intervals
Next
From: Bruce Momjian
Date:
Subject: Re: BUG #1993: Adding/subtracting negative time intervals