Created
April 26, 2012 03:51
-
-
Save mipearson/2495661 to your computer and use it in GitHub Desktop.
Example of MySQL default being harmful
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mirrored from http://flooble.net/~pete/fuck-you-mysql-you-fucking-fuck-of-a-fuckstick.txt | |
mysql> create table fuckyou ( id integer primary key auto_increment, name varchar(20) not null ); | |
Query OK, 0 rows affected (0.00 sec) | |
mysql> insert into fuckyou (name) values (null); | |
ERROR 1048 (23000): Column 'name' cannot be null | |
mysql> insert into fuckyou (name) values ('pete'); | |
Query OK, 1 row affected (0.00 sec) | |
mysql> select * from fuckyou; | |
+----+------+ | |
| id | name | | |
+----+------+ | |
| 1 | pete | | |
+----+------+ | |
1 row in set (0.00 sec) | |
mysql> update fuckyou set name = null; | |
Query OK, 1 row affected, 1 warning (0.00 sec) | |
Rows matched: 1 Changed: 1 Warnings: 1 | |
mysql> select * from fuckyou where name is null; | |
Empty set (0.00 sec) | |
mysql> select * from fuckyou where name = ''; | |
+----+------+ | |
| id | name | | |
+----+------+ | |
| 1 | | | |
+----+------+ | |
1 row in set (0.00 sec) | |
mysql> select version(), current_date(); | |
+-------------------+----------------+ | |
| version() | current_date() | | |
+-------------------+----------------+ | |
| 5.1.49-1ubuntu8.1 | 2012-04-26 | | |
+-------------------+----------------+ | |
1 row in set (0.04 sec) | |
mysql> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment