Re: Division by zero
От | Michael Fuhr |
---|---|
Тема | Re: Division by zero |
Дата | |
Msg-id | 20050416090510.GA35437@winnie.fuhr.org обсуждение исходный текст |
Ответ на | Division by zero (Costin Manda <siderite@madnet.ro>) |
Список | pgsql-general |
On Sat, Apr 16, 2005 at 10:15:55AM +0300, Costin Manda wrote: > > In other SQL programs a division by zero is solved by transforming the > result to NULL. The SQL standards state that "If the value of a divisor is zero, then an exception condition is raised: data exception -- division by zero." Databases that silently convert this exception to NULL (e.g., MySQL) are violating standards. > How can I make postgres have the same behaviour without using CASE ? Why don't you want to use CASE? Because it's unwieldy? You could wrap CASE in a function and call that function instead of using the / operator. I'd avoid any temptation to change the behavior of the operator itself because that could cause problems in other code that isn't expecting it. -- Michael Fuhr http://www.fuhr.org/~mfuhr/
В списке pgsql-general по дате отправления: