Re: pg_atoi error

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: pg_atoi error
Дата
Msg-id 20040123175705.GA24571@wolff.to
обсуждение исходный текст
Ответ на Re: pg_atoi error  (LIANHE SHAO <lshao2@jhmi.edu>)
Список pgsql-novice
On Fri, Jan 23, 2004 at 17:34:39 +0000,
  LIANHE SHAO <lshao2@jhmi.edu> wrote:
>
> Seems you missed my point.
> Actually I am wondering if pgsql can work on its own
> with garbage data like mysql. for example if it
> should be expid ='1' but I use it with expid='xyz'.
> In this case, MySql will seliently give you 0 row
> instead of error message. From your point, Seems
> Pgsql will only give error message unless you deal
> with it manually.

Why do you think Postgres should magically pick 0 out of all of the
possible numbers to use?

If you want garbage to be treated as 0 you can write a function to
do it. If you use this function to create a cast from text to int
this might even work without you having to call the function around
the questionable data. I am not absolutely sure that unknown will
go to int through text in preference to directly to int though.
If in the real case your data isn't qouted strings but text data
already in a table, then it should work.

В списке pgsql-novice по дате отправления:

Предыдущее
От: LIANHE SHAO
Дата:
Сообщение: Re: pg_atoi error
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg_atoi error