Re: 8.3 vs HEAD difference in Interval output?

From: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kevin Grittner <Kgrittn(dot)CCAP(dot)Courts(at)wicourts(dot)gov>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: 8.3 vs HEAD difference in Interval output?
Date: 2008-10-09 18:50:17
Message-ID: 48EE5269.4030405@cheapcomplexdevices.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kevin Grittner wrote:
>>>> "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> wrote:
>
> Even more surprising is the behavior for interval(1) here:
> [.... some context with nonsurprising examples removed ...]
> ccdev=# select '1 year 2 mons 3 days 04:05:06.64321'::interval(1);
> interval
> ----------------------------------
> 1 year 2 mons 3 days 04:05:06.60
> (1 row)
>
> That trailing zero should be considered a bug.

Is there a consensus that we don't want that trailing zero?
I notice that datetime.c's "TrimTrailingZeros(char *str)" has
the comment:
/* chop off trailing zeros... but leave at least 2 fractional digits */
that suggests that the trailing zero was intentional, but I
can't find any reasons why 2 fractional disgits were left.

The same function's also used for timestamps, so if we remove that
trailing zero in both places we'll see some regression differences
where we get
! | Mon Feb 10 17:32:01.5 1997 PST | 1997 | 7 | 1
instead of
! | Mon Feb 10 17:32:01.50 1997 PST | 1997 | 7 | 1

IMHO we don't want the extra zero for timestamps either.

If people agree I'll fold it into the patch dealing with
the other interval rounding eccentricities I have.

Tom Lane wrote:
> Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com> writes:
>> [some other interval rounding example]
>
> I don't much like the forced rounding to two digits here, but changing
> that doesn't seem like material for back-patching. Are you going to
> fix that up while working on your other patches?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kenneth Marshall 2008-10-09 19:14:37 Re: 8.3 vs HEAD difference in Interval output?
Previous Message Alvaro Herrera 2008-10-09 17:25:24 Re: [WIP] plpgsql is not translate-aware