Re: pg_atoi()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Harvey Chapman <hchapman(at)3gfp(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pg_atoi()
Date: 2000-06-29 01:52:12
Message-ID: 18065.962243532@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Harvey Chapman <hchapman(at)3gfp(dot)com> writes:
> 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.

Because that's what it ought to do, if you ask me ;-).
"109 foo" is not a valid integer value. If you want your app to
accept such things, do your own input parsing and filtering.
A database server should not be lax about what it considers valid
data.

regards, tom lane

In response to

  • pg_atoi() at 2000-06-29 01:14:25 from Richard Harvey Chapman

Browse pgsql-general by date

  From Date Subject
Next Message Richard Harvey Chapman 2000-06-29 02:06:38 Comments with embedded single quotes
Previous Message Charles Tassell 2000-06-29 01:44:37 Re: Interface Question