You're viewing a single post. I have much more to say! The main blog page is a good starting point.

Missing comma

I was writing a chunk of SQL code and tried to execute it. However, MySQL choked on the input and printed the following error:

ERROR 1136 (21S01) at line 22:
Column count doesn't match value count at row 3

Pretty obvious to fix, you might think. I just forgot to provide a value for a column in my INSERT statement. However, everything seemed correct in my editor. The query was split over more than 50 lines (multiple records inserted in one single query), and line number 22 was just the first line of those…

It took me ten minutes to figure out what was wrong: a missing comma between two long (multi-line) strings caused silent string concatenation of the two, causing the above error. Ugh. Try to spot that one on your 8pt terminal!