Skip site navigation (1) Skip section navigation (2)

Re: BUG #4231: Interval silent seconds 32-bit wraparound when given as text

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Geoff Tolley" <geoff(at)polimetrix(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4231: Interval silent seconds 32-bit wraparound when given as text
Date: 2008-06-09 18:45:14
Message-ID: 25864.1213037114@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"Geoff Tolley" <geoff(at)polimetrix(dot)com> writes:
> When you make an interval by giving it a text representation of a number of
> seconds, it appears to have a silent 32-bit wraparound (the example here is
> from some raw SPSS data from a colleague; apparently it uses October 14th
> 1584 as its base so the seconds output tends to be >> 2^31):

Hmm ... it works properly on a 32-bit machine ...

There are a boatload of occurrences of this pattern in datetime.c:

                    integer_variable = strtol(field[i], &cp, 10);
                    if (errno == ERANGE)
                        return DTERR_FIELD_OVERFLOW;

which is okay if long and int are the same size, but not so much
otherwise.  Looks like we need to fix that.

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: A.AnibayevDate: 2008-06-10 04:45:17
Subject:
Previous:From: Geoff TolleyDate: 2008-06-09 18:19:19
Subject: BUG #4231: Interval silent seconds 32-bit wraparound when given as text

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group