Re: [HACKERS] Interval aggregate regression failure (expected seems - Mailing list pgsql-patches

From Michael Glaesemann
Subject Re: [HACKERS] Interval aggregate regression failure (expected seems
Date
Msg-id 56E37AA9-048A-422B-AA26-E0A1F09314F0@seespotcode.net
Whole thread Raw
In response to Re: [HACKERS] Interval aggregate regression failure  (Bruce Momjian <bruce@momjian.us>)
Responses Re: [HACKERS] Interval aggregate regression failure  (Bruce Momjian <bruce@momjian.us>)
List pgsql-patches
On Aug 30, 2006, at 1:13 , Bruce Momjian wrote:

> Uh, I came up with a cleaner one, I think.  I didn't test
> --enable-integer-datetimes yet.

Cool. It's indeed much cleaner. Thanks, Bruce. I'm about to head to
bed, but I'll look at it more closely tomorrow.

I also noticed that my regression tests didn't exercise the code I
thought it did. If you have a chance before I get to it, you might
want to try these as well:

select interval '41 mon 12 days 360:00' / 10 as quotient_a
     , interval '41 mon -12 days -360:00' / 10 as quotient_b
     , interval '-41 mon 12 days 360:00' / 10 as quotient_c
     , interval '-41 mon -12 days -360:00' / 10 as quotient_d;
        quotient_a       |       quotient_b        |
quotient_c         |        quotient_d
------------------------+-------------------------
+---------------------------+---------------------------
4 mons 4 days 40:48:00 | 4 mons 2 days -40:48:00 | -4 mons -2 days
+40:48:00 | -4 mons -4 days -40:48:00
(1 row)

select interval '41 mon 12 days 360:00' * 0.3 as product_a
     , interval '41 mon -12 days -360:00' * 0.3 as product_b
     , interval '-41 mon 12 days 360:00' * 0.3 as product_c
     , interval '-41 mon -12 days -360:00' * 0.3 as product_d;
         product_a         |          product_b          |
product_c          |            product_d
--------------------------+-----------------------------
+-----------------------------+---------------------------------
1 year 12 days 122:24:00 | 1 year 6 days -122:23:60.00 | -1 years -6
days +122:24:00 | -1 years -12 days -122:23:60.00
(1 row)

The quotients look fine, but I'm wondering if another set of rounding
is needed to bump those -122:23:60.00 to -122:24:00 in product_b and
product_d.

Michael Glaesemann
grzm seespotcode net


pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Interval aggregate regression failure
Next
From: Alvaro Herrera
Date:
Subject: Re: Updatable views