On Thu, Sep 4, 2008 at 17:14, Jeremy Stephens
<jeremy.f.steph...@vanderbilt.edu> wrote:
> What the fuck?  When I divide two integers, I expect a integer back, dammit.

Welcome to the wonderful world of MySQL.

> What's even more awesome is that MySQL will round the result if you try to
> insert the value into an integer column.
>
> mysql> create table foo (bar int);
> Query OK, 0 rows affected (0.00 sec)
>
> mysql> insert into foo values(3 / 4);
> Query OK, 1 row affected (0.02 sec)

You could also try "insert into foo values ('2')", for example.

(Which would arguably be something that, say, a Perl programmer would
expect simply works, though, say, Python programmers would have a
different opinion since most languages don't automatically cast
between strings and numbers.)

Cheers,
-- 
Philip Newton <philip.new...@gmail.com>

Reply via email to