Example of MySQL default being harmful

  • Download Gist
fuck-you-mysql-you-fucking-fuck-of-a-fuckstick.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
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>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.