Re: pg_atoi error
| От | Bruno Wolff III |
|---|---|
| Тема | Re: pg_atoi error |
| Дата | |
| Msg-id | 20040123151215.GA13726@wolff.to обсуждение исходный текст |
| Ответ на | pg_atoi error (LIANHE SHAO <lshao2@jhmi.edu>) |
| Список | pgsql-novice |
On Fri, Jan 23, 2004 at 15:01:15 +0000, LIANHE SHAO <lshao2@jhmi.edu> wrote: > Hello, > > In my query: > select * from experimentinfo where expid='1'; > here data type of expid is int. > My question is: > if I change expid ='xyz', error is: pg_atoi: error > in "xyz": can't parse "xyz" > if I change expid ='', error is: pg_atoi: > zero-length string > > In mysql, seems this will not happen and will give > you 0 row result. but not error message. If you want to shoot yourself in the foot go use mysql. > > So, How can I avoid these annoying message? You can either have your application handle obviously bogus data or you can write a function in postgres that converts text to int using whatever rules you want for assigning values to nonnumeric strings.
В списке pgsql-novice по дате отправления: