top | item 4325403

(no title)

tdavis | 13 years ago

As much as anything else, this is another great example of MySQL letting you shoot yourself in the face by default. I also love that you can save "y" to an integer field without complaint. It seems obvious that accurate data validation and comparison would be the cornerstone of a successful relational database, yet MySQL defaults fail to provide any domain-relevant value whatsoever.

discuss

order

ars|13 years ago

bin is not an integer field. It's a binary field - it can save anything.

And no, you can not save 'y' to an integer field, so your rant is misplaced.

mbrubeck|13 years ago

I think tdavis is referring to this example from maciej's post, where inserting 'y' into a tinyint field silently converts it to 0 instead of throwing an error:

     mysql> create table demo(int tinyint(1), bin binary(1));
     mysql> insert into demo(int, bin) values ('y', 'y');
     mysql> select * from demo;

     +------+------+
     | int  | bin  | 
     +------+------+
     |    0 | y    |
     +------+------+