Thread: Re: [HACKERS] regressin failure on latest CVS

Re: [HACKERS] regressin failure on latest CVS

From
"Rocco Altier"
Date:
This patch fixes the interval regression on my AIX box (kookaburra) by
only doing integer math on the interval, instead of float/double math.

I think this is the correct way to handle this, since it's an integer
data type.

I don't know if it will fix Olivier's problem, since I wasn't able to
reproduce it.

Thanks,
    -rocco

> -----Original Message-----
> From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Bruce Momjian
> Sent: Friday, July 22, 2005 10:41 AM
> To: Michael Glaesemann
> Cc: ohp@pyrenet.fr; pgsql-hackers@postgresql.org
> Subject: Re: [HACKERS] regressin failure on latest CVS
>
>
> Michael Glaesemann wrote:
> >
> > On Jul 22, 2005, at 6:28 PM, ohp@pyrenet.fr wrote:
> >
> > > I tried the latest cvs this morning (07/22 11:00 CET)
> > > and interval test fails.
> > > Here's the regression.diffs.
> >
> > >
> > > *** ./expected/interval.out    Fri Jul 22 10:32:21 2005
> > > --- ./results/interval.out    Fri Jul 22 11:07:54 2005
> > > ***************
> > > *** 217,224 ****
> > >   -- updating pg_aggregate.agginitval
> > >   select avg(f1) from interval_tbl;
> > >                          avg
> > > ! -------------------------------------------------
> > > !  @ 4 years 1 mon 10 days 4 hours 18 mins 23 secs
> > >   (1 row)
> > >
> > >   -- test long interval input
> > > --- 217,224 ----
> > >   -- updating pg_aggregate.agginitval
> > >   select avg(f1) from interval_tbl;
> > >                         avg
> > > ! ------------------------------------------------
> > > !  @ 4 years 1 mon 9 days 4 hours 18 mins 23 secs
> > >   (1 row)
> > >
> > >   -- test long interval input
> >
> > Could you provide platform information? Did you build with
> --enable-
> > integer-datetimes? Looking at the buildfarm, kookaburra
> (AIX 5.2) is
> > also failing the interval test at the same point, but the
> result is
> > different.
>
> Interesting.  I don't see the error with our without
> --enable-integer-datetimes.  I even tried changing my
> timezone to Paris
> time and still could not reproduce the failure.
>
> On the AIX problem below, we are going to get rounding issues.
>
> --------------------------------------------------------------
> -------------
>
>
> > http://pgbuildfarm.org/cgi-bin/show_history.pl?nm=kookaburra&br=HEAD
> >
> > ================== pgsql.36852/src/test/regress/regression.diffs
> > ===================
> > *** ./expected/interval.out     Fri Jul 22 01:25:05 2005
> > --- ./results/interval.out      Fri Jul 22 01:34:20 2005
> > ***************
> > *** 217,224 ****
> >    -- updating pg_aggregate.agginitval
> >    select avg(f1) from interval_tbl;
> >                           avg
> > ! -------------------------------------------------
> > !  @ 4 years 1 mon 10 days 4 hours 18 mins 23 secs
> >    (1 row)
> >
> >    -- test long interval input
> > --- 217,224 ----
> >    -- updating pg_aggregate.agginitval
> >    select avg(f1) from interval_tbl;
> >                            avg
> > ! ----------------------------------------------------
> > !  @ 4 years 1 mon 10 days 4 hours 18 mins 22.99 secs
> >    (1 row)
> >
> >
> > Michael Glaesemann
> > grzm myrealbox com
> >
> >
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 1: if posting/reading through Usenet, please send an appropriate
> >        subscribe-nomail command to majordomo@postgresql.org
> so that your
> >        message can get through to the mailing list cleanly
> >
>
> --
>   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
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
               http://archives.postgresql.org

Attachment

Re: [HACKERS] regressin failure on latest CVS

From
Bruce Momjian
Date:
Rocco Altier wrote:
> This patch fixes the interval regression on my AIX box (kookaburra) by
> only doing integer math on the interval, instead of float/double math.
>
> I think this is the correct way to handle this, since it's an integer
> data type.
>
> I don't know if it will fix Olivier's problem, since I wasn't able to
> reproduce it.
>

I have changed the way I compute the remainder values --- instead of
using multiplication, I use division and then subtraction.  This should
fix your rounding problem.  Looking at your fix, I don't see how adding
USECS changes things because the factor is already a float, but I think
the problem was more the way I was computing the remainders.

Patch attached --- let me know if it does not fix your problem.

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


> Thanks,
>     -rocco
>
> > -----Original Message-----
> > From: pgsql-hackers-owner@postgresql.org
> > [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Bruce Momjian
> > Sent: Friday, July 22, 2005 10:41 AM
> > To: Michael Glaesemann
> > Cc: ohp@pyrenet.fr; pgsql-hackers@postgresql.org
> > Subject: Re: [HACKERS] regressin failure on latest CVS
> >
> >
> > Michael Glaesemann wrote:
> > >
> > > On Jul 22, 2005, at 6:28 PM, ohp@pyrenet.fr wrote:
> > >
> > > > I tried the latest cvs this morning (07/22 11:00 CET)
> > > > and interval test fails.
> > > > Here's the regression.diffs.
> > >
> > > >
> > > > *** ./expected/interval.out    Fri Jul 22 10:32:21 2005
> > > > --- ./results/interval.out    Fri Jul 22 11:07:54 2005
> > > > ***************
> > > > *** 217,224 ****
> > > >   -- updating pg_aggregate.agginitval
> > > >   select avg(f1) from interval_tbl;
> > > >                          avg
> > > > ! -------------------------------------------------
> > > > !  @ 4 years 1 mon 10 days 4 hours 18 mins 23 secs
> > > >   (1 row)
> > > >
> > > >   -- test long interval input
> > > > --- 217,224 ----
> > > >   -- updating pg_aggregate.agginitval
> > > >   select avg(f1) from interval_tbl;
> > > >                         avg
> > > > ! ------------------------------------------------
> > > > !  @ 4 years 1 mon 9 days 4 hours 18 mins 23 secs
> > > >   (1 row)
> > > >
> > > >   -- test long interval input
> > >
> > > Could you provide platform information? Did you build with
> > --enable-
> > > integer-datetimes? Looking at the buildfarm, kookaburra
> > (AIX 5.2) is
> > > also failing the interval test at the same point, but the
> > result is
> > > different.
> >
> > Interesting.  I don't see the error with our without
> > --enable-integer-datetimes.  I even tried changing my
> > timezone to Paris
> > time and still could not reproduce the failure.
> >
> > On the AIX problem below, we are going to get rounding issues.
> >
> > --------------------------------------------------------------
> > -------------
> >
> >
> > > http://pgbuildfarm.org/cgi-bin/show_history.pl?nm=kookaburra&br=HEAD
> > >
> > > ================== pgsql.36852/src/test/regress/regression.diffs
> > > ===================
> > > *** ./expected/interval.out     Fri Jul 22 01:25:05 2005
> > > --- ./results/interval.out      Fri Jul 22 01:34:20 2005
> > > ***************
> > > *** 217,224 ****
> > >    -- updating pg_aggregate.agginitval
> > >    select avg(f1) from interval_tbl;
> > >                           avg
> > > ! -------------------------------------------------
> > > !  @ 4 years 1 mon 10 days 4 hours 18 mins 23 secs
> > >    (1 row)
> > >
> > >    -- test long interval input
> > > --- 217,224 ----
> > >    -- updating pg_aggregate.agginitval
> > >    select avg(f1) from interval_tbl;
> > >                            avg
> > > ! ----------------------------------------------------
> > > !  @ 4 years 1 mon 10 days 4 hours 18 mins 22.99 secs
> > >    (1 row)
> > >
> > >
> > > Michael Glaesemann
> > > grzm myrealbox com
> > >
> > >
> > >
> > > ---------------------------(end of
> > broadcast)---------------------------
> > > TIP 1: if posting/reading through Usenet, please send an appropriate
> > >        subscribe-nomail command to majordomo@postgresql.org
> > so that your
> > >        message can get through to the mailing list cleanly
> > >
> >
> > --
> >   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
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 4: Have you searched our list archives?
> >
>                http://archives.postgresql.org

Content-Description: timestamp.patch

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

--
  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
Index: src/backend/utils/adt/timestamp.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v
retrieving revision 1.144
diff -c -c -r1.144 timestamp.c
*** src/backend/utils/adt/timestamp.c    23 Jul 2005 14:25:34 -0000    1.144
--- src/backend/utils/adt/timestamp.c    23 Jul 2005 14:51:05 -0000
***************
*** 2308,2316 ****
      result->day = span->day / factor;
      result->time = span->time / factor;

!     /* Computer remainders */
!     month_remainder = (span->month - result->month * factor) / factor;
!     day_remainder = (span->day - result->day * factor) / factor;

      /* Cascade fractions to lower units */
      /* fractional months full days into days */
--- 2308,2316 ----
      result->day = span->day / factor;
      result->time = span->time / factor;

!     /* Compute remainders */
!     month_remainder = span->month / factor - result->month;
!     day_remainder = span->day / factor - result->day;

      /* Cascade fractions to lower units */
      /* fractional months full days into days */