MySQL parser errors

faraonem's profile image faraonem posted 4 years ago in Running SQL scripts Permalink

Hi, I've found a MySQL script parse error (IN statement) without any warnig sent to user. Here is the evidence.

Write down any select statement with condition in a list. E.G.:

SELECT FROM progetti p WHERE p.struttura=392 AND p.numproj in ( '20C120', '20C91', '20C92', '20C93' ); / Affected rows: 0 Found rows: 4 Warnings: 0 Duration for 1 query: 0,125 sec. */

This is correct, but now rwrite down the same query and intentionally do not use ',' between elements in list:

SELECT FROM progetti p WHERE p.struttura=392 AND p.numproj in ( '20C120' '20C91' '20C92' '20C93' ); / Affected rows: 0 Found rows: 0 Warnings: 0 Duration for 1 query: 0,125 sec. */

Query executed without any warning... Forgetting ',' could potentially lead user to think errouneusly that query is correct and there are no results at all.

Best regards.

Please login to leave a reply, or register at first.