pg_atoi()

From: Richard Harvey Chapman <hchapman(at)3gfp(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: pg_atoi()
Date: 2000-06-29 01:14:25
Message-ID: Pine.LNX.4.10.10006281803050.18540-100000@smile.3gfp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is there a reason why pg_atoi() was programmed to fail if the entire
input string is not valid?
i.e. "109" yields 109, but "109 apples" yields an error.

Snippet from pg_atoi() in src/backend/utils/adt/numutils.c:

l = strtol(s, &badp, 10);

if (errno) /* strtol must set ERANGE */
elog(ERROR, "pg_atoi: error reading \"%s\": %m", s);
if (badp && *badp && (*badp != c))
elog(ERROR, "pg_atoi: error in \"%s\": can\'t parse
\"%s\"", s, badp);


Thanks,

R.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2000-06-29 01:44:30 Re: Re[2]: Restricting queries by the presence of a WHERE clause
Previous Message Lincoln Yeoh 2000-06-29 01:09:19 Re: Re[2]: Restricting queries by the presence of a WHERE clause