Re: Strange interval arithmetic
- From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
- To: Michael Fuhr <mike(at)fuhr(dot)org>
- Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
- Subject: Re: Strange interval arithmetic
- Date: Wed, 30 Nov 2005 19:06:42 -0300
- Message-id: <20051130220642(dot)GA15341(at)surnet(dot)cl>
Michael Fuhr wrote:
> Agreed. I'm thinking about rewriting strtol() calls in datetime.c
> to look like this:
>
> errno = 0;
> val = strtol(field[i], &cp, 10);
> if (errno == ERANGE)
> return DTERR_FIELD_OVERFLOW;
Hmm, why not check both the return value _and_ errno:
val = strtol(field[i], &cp, 10);
if (val == LONG_MAX && errno == ERANGE)
return DTERR_FIELD_OVERFLOW;
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Home |
Main Index |
Thread Index