Re: pg_atoi error

Поиск
Список
Период
Сортировка
От george young
Тема Re: pg_atoi error
Дата
Msg-id 20040204092200.56694fab.gry@ll.mit.edu
обсуждение исходный текст
Ответ на Re: pg_atoi error  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
On Fri, 23 Jan 2004 12:59:15 -0500
Tom Lane <tgl@sss.pgh.pa.us> threw this fish to the penguins:

> LIANHE SHAO <lshao2@jhmi.edu> writes:
> > 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.
>
> This is a fundamental difference in philosophy between the two projects.
> You are wasting your breath trying to convince any Postgres developer
> that this aspect of MySQL's behavior is a wise design.  And I'm sure you
> would get equally much push-back from the MySQL developers if you tried
> to persuade them to tighten their error checking.  If MySQL's philosophy
> agrees with your worldview, then you should probably go use MySQL.
>
> Alternatively, you can write your own conversion function that does what
> you want, as several people have suggested already.  You can even cause
> it to become the default behavior in your installation (just change the
> input function for type int4).  But it's not going to become the
> standard behavior for Postgres.
>
>             regards, tom lane

Philosophy aside, I would object strongly to postgres quietly accepting
garbage as a zero.  If some application is feeding a string value to the
wrong field, I certainly want it to fail, with clanging bells and crashing
the app (or at least generating an exception...).  Otherwise leads to
data corruption that could be dangerous and very difficult to unravel.
It's the application's job to validate data, not postgres.

--
"Are the gods not just?"  "Oh no, child.
What would become of us if they were?" (CSL)

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Can a user change their own password?
Следующее
От: "Bantamess"
Дата:
Сообщение: Dual Primary keys