MySQL Parser Error Reporting
The error reporting for the MySQL query parser can be pretty brutal. For example:
create table books
(
id int not null auto_increment,
author_id int not null,
title varchar(255)
price decimal(10,2),
constraint fk_books_author foreign key (author_id) references authors(id),
primary_key (id)
);
The table definition above generates this error:
ERROR 1064 (42000) at line 1: 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 'price decimal(10,2),
constraint fk_books_author foreign key (author_id) refer' at line 6
Any idea where the problem is? The "line 1" bit is extremely misleading. It turns out the problem is that the the table definition uses "primary_key" instead of "primary key".

MySQL Parser Error Reporting
Posted Oct 11, 2005 — 4 comments below
Posted Oct 11, 2005 — 4 comments below
Werner — Oct 12, 05 428
Scott Stevenson — Oct 12, 05 429
Jesper — Oct 12, 05 430
Scott Stevenson — Oct 12, 05 432