MySQL Anguish

For most projects, I use PostgreSQL. It’s great, it scales extremely well across multi-core multi-cpu machines, it’s loaded with features, and it handles everything you can throw at it with grace. I also try to maintain respect for MySQL, and the last thing I want to start is a flame war, but dammit, every time I try doing something with MySQL, I run across bugs, things that weren’t thought out, and very unelegant solutions.

Just for instance, today I was laying out some tables for a MySQL project I’m working on in my spare time, and I came across one of the most retarded things ever: you can’t create a field with “now()” as the default value, unless the field is an actual timestamp (ie., doesn’t work for date, time, etc). Now that wouldn’t be so bad if you could use current_date() for the default value, but apparently MySQL won’t let me do that either.

Here’s the result on MySQL 5.0:

mysql> CREATE TABLE test (d DATE NOT NULL DEFAULT CURRENT_DATE());

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘CURRENT_DATE())’ at line 1

Update: Comments are disabled due to spamming.

Comments are closed.