Archive for November, 2010

MySQL: Max allowed packet or file upload watch-out

Apparently some web applications do store uploaded files in the database as blob field by default (for instance it is true for Mantis bug tracker). While it is acceptable (but not too common?) to store files in the database, it may cause certain problems like uploading large files (particularly 1Mb+).

Normally the first thing to look at would be the actual application configuration. OK, Mantis is configured to accept files up to 5Mb by default. I.e. no problems here. Wait… but PHP is configured to accept files up to 2Mb by default… So where does 1Mb restriction come from?

The answer is that it comes from the database. MySQL has limits on packet size. The largest possible packet that can be transmitted to or from a MySQL 5.1 server or client is 1Gb. However by default it is 1Mb! As result any packets larger than 1Mb will cause packet too large error.

There is max_allowed_packet option in the configuration which allows to set the packet size. For example:

[mysqld]
max_allowed_packet=16M

The Tourist

Coming on December, 10 2010. Johny Depp does not make bad movies, especially with Angelina Jolie. 🙂

MySQL temporary table watch-out – unknown column error

Recently I’ve run into another MySQL bug. This time it is related to temporary tables. The bug was reported as #12257.

Basically select * from tmpTable does not work within stored procedure if any column is altered since the table has been originally created. So MySQL keeps converting * to a old column list while some columns may not exist anymore.

A simple workaround allows to eliminate impact of this bug as well as using select * is not recommended anyway. However the most surprising part of this story that this bug cannot be resolved for more than 5 years: it was reported in 2005.

The power of punctuation

Here is another story that shows how commas are important..

A panda walks into a café. He orders a sandwich, eats it, then takes out a gun and fires it at the other patrons. “Why?” asks the confused, surviving waiter, as the panda makes towards the exit. The panda produces a badly punctuated wildlife manual and tosses it over his shoulder.
“Well, I’m a panda,” he says, at the door. “Look it up”. The waiter turns to the information on pandas in the manual and finds an explanation. “Panda. Large black-and-white bear-like animal, native to China. Eats, shoots, and leaves.”.

The poorly punctuated manual caused all of these problems for the panda and the people in the café. The correct punctuation for the last sentence in the story should not include any commas (simply eats shoots and leaves).

Thanks to Lucy with ESL Podcasts for such a good article.

Roomba Driver

Heathrow Terminal 5 – 27th October 2010

Amazing video how arriving passengers were given a welcome home to remember from T-Mobile at Heathrow Terminal 5.