Lately I’ve been getting the occasional “Error 12 from table handler” from the MySQL server on my latest pet project. It’s only certain queries that fail, but when it has failed once it seemingly keeps failing until the MySQL server is bounced.
Apparently for a query to fail, all it needs is to be a join with two tables with the result ordered. Ie
SELECT * FROM a, b WHERE a.id = b.join_id ORDER BY a.id
Removing the “order by” clause makes the error go away.
I have no idea what the error means, apart from that it apparently has something to do with memory. The two tables in question have 5 and 40 rows respectivly, so it’s not like it’s a big resultset to order.
Switching my table type from MyISAM to INNO DB seemed to make the errors go away - at least for now…
Update: It seems that this might’ve been a bug in MySQL v4.0something, at least that’s what my host have informed me. Here’s hoping for a repair/upgrade soon’ish.
The other thing you can try is using an ANSI style of join (which is more universal with other db's anyway). What you have could be written like so:
SELECT * FROM a INNER JOIN b ON a.id = b.join_id ORDER BY a.id
Using this style also makes it easier to understand what's really going on when you move to more complex joins like LEFT and RIGHT OUTER JOINs.
(btw: since you've got the room, you should make your inputs bigger on your form)
Thanks for the idea, unfortunatly the INNER JOIN style query results in the same error 12 from table handler.
And it seems changing to INNO DB did nothing either.