pgsql: Fix (hopefully for the last time) problems with datetime values

Lists: pgsql-committers
From: tgl(at)svr1(dot)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix (hopefully for the last time) problems with datetime values
Date: 2005-10-09 17:21:47
Message-ID: 20051009172147.A8605D945E@svr1.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

Log Message:
-----------
Fix (hopefully for the last time) problems with datetime values displaying
like '23:59:60' because of fractional-second roundoff problems. Trying
to control this upstream of the actual display code was hopeless; the right
way is to explicitly round fractional seconds in the display code and then
refigure the results if the fraction rounds up to 1. Per bug #1927.

Modified Files:
--------------
pgsql/src/interfaces/ecpg/pgtypeslib:
dt.h (r1.31 -> r1.32)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/ecpg/pgtypeslib/dt.h.diff?r1=1.31&r2=1.32)
dt_common.c (r1.29 -> r1.30)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c.diff?r1=1.29&r2=1.30)
interval.c (r1.28 -> r1.29)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/ecpg/pgtypeslib/interval.c.diff?r1=1.28&r2=1.29)
timestamp.c (r1.31 -> r1.32)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/ecpg/pgtypeslib/timestamp.c.diff?r1=1.31&r2=1.32)
pgsql/contrib/btree_gist:
btree_ts.c (r1.10 -> r1.11)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/btree_gist/btree_ts.c.diff?r1=1.10&r2=1.11)
pgsql/src/backend/utils/adt:
date.c (r1.120 -> r1.121)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/date.c.diff?r1=1.120&r2=1.121)
datetime.c (r1.157 -> r1.158)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/datetime.c.diff?r1=1.157&r2=1.158)
timestamp.c (r1.153 -> r1.154)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/timestamp.c.diff?r1=1.153&r2=1.154)
pgsql/src/include/utils:
date.h (r1.30 -> r1.31)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/date.h.diff?r1=1.30&r2=1.31)
timestamp.h (r1.55 -> r1.56)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/timestamp.h.diff?r1=1.55&r2=1.56)


From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)svr1(dot)postgresql(dot)org>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Fix (hopefully for the last time) problems with datetime values
Date: 2005-10-09 18:56:42
Message-ID: 20051009185642.GA53305@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

On Sun, Oct 09, 2005 at 02:21:47PM -0300, Tom Lane wrote:
> Fix (hopefully for the last time) problems with datetime values displaying
> like '23:59:60' because of fractional-second roundoff problems. Trying
> to control this upstream of the actual display code was hopeless; the right
> way is to explicitly round fractional seconds in the display code and then
> refigure the results if the fraction rounds up to 1. Per bug #1927.

This change causes my FreeBSD 4.11-STABLE box and a couple of FreeBSD 6
members of the buildfarm to fail while building ecpg:

timestamp.c: In function `timestamp2tm':
timestamp.c:195: `INT_MAX' undeclared (first use in this function)

Including <limits.h> in src/interfaces/ecpg/pgtypeslib/timestamp.c
fixes the problem.

--
Michael Fuhr


From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: Tom Lane <tgl(at)svr1(dot)postgresql(dot)org>, pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Fix (hopefully for the last time) problems with datetime values
Date: 2005-10-09 20:43:20
Message-ID: 6FDBEE93-8D96-4D70-9E41-4FB625CF726C@lerctr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers


On Oct 9, 2005, at 1:56 PM, Michael Fuhr wrote:

> On Sun, Oct 09, 2005 at 02:21:47PM -0300, Tom Lane wrote:
>
>> Fix (hopefully for the last time) problems with datetime values
>> displaying
>> like '23:59:60' because of fractional-second roundoff problems.
>> Trying
>> to control this upstream of the actual display code was hopeless;
>> the right
>> way is to explicitly round fractional seconds in the display code
>> and then
>> refigure the results if the fraction rounds up to 1. Per bug #1927.
>>
>
> This change causes my FreeBSD 4.11-STABLE box and a couple of
> FreeBSD 6
> members of the buildfarm to fail while building ecpg:
>
> timestamp.c: In function `timestamp2tm':
> timestamp.c:195: `INT_MAX' undeclared (first use in this function)
>
> Including <limits.h> in src/interfaces/ecpg/pgtypeslib/timestamp.c
> fixes the problem.

firefly (my UnixWare box as well) dies with this.

LER

>
> --
> Michael Fuhr
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 214-351-4152 E-Mail: ler(at)lerctr(dot)org
US Mail: 3535 Gaspar Drive, Dallas, TX 75220-3611


From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Larry Rosenman <ler(at)lerctr(dot)org>
Cc: Tom Lane <tgl(at)svr1(dot)postgresql(dot)org>, pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Fix (hopefully for the last time) problems with datetime values
Date: 2005-10-09 23:27:40
Message-ID: 20051009232740.GA59285@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

On Sun, Oct 09, 2005 at 03:43:20PM -0500, Larry Rosenman wrote:
> On Oct 9, 2005, at 1:56 PM, Michael Fuhr wrote:
> >This change causes my FreeBSD 4.11-STABLE box and a couple of
> >FreeBSD 6 members of the buildfarm to fail while building ecpg:
> >
> >timestamp.c: In function `timestamp2tm':
> >timestamp.c:195: `INT_MAX' undeclared (first use in this function)
> >
> >Including <limits.h> in src/interfaces/ecpg/pgtypeslib/timestamp.c
> >fixes the problem.
>
> firefly (my UnixWare box as well) dies with this.

When you say "firefly dies with this," which "this" are you referring
to? The original change, my suggestion to include <limits.h>, or both?
At least the first, apparently:

http://pgbuildfarm.org/cgi-bin/show_log.pl?nm=firefly&dt=2005-10-09%2020:27:01

My Solaris 9 box also failed with the original change.

--
Michael Fuhr


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Fix (hopefully for the last time) problems with datetime values
Date: 2005-10-10 01:34:52
Message-ID: 10247.1128908092@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

Michael Fuhr <mike(at)fuhr(dot)org> writes:
> timestamp.c: In function `timestamp2tm':
> timestamp.c:195: `INT_MAX' undeclared (first use in this function)

> Including <limits.h> in src/interfaces/ecpg/pgtypeslib/timestamp.c
> fixes the problem.

Oops, fixed. Thanks for the report.

regards, tom lane