sysown / proxysql

High-performance MySQL proxy with a GPL license.
http://www.proxysql.com
GNU General Public License v3.0
5.93k stars 967 forks source link

Incorrect SQL parsing. #4592

Open Abigail opened 1 month ago

Abigail commented 1 month ago

Line 2871 of lib/mysqly_connection.cpp reads:

if (strcasestr(query_digest_text,"GET_LOCK(")) {

This however, is an incorrect way of parsing SQL. In particular, there is an optional space between GET_LOCK and the opening parenthesis.

Which means that the following SQL code does disable multiplexing:

SELECT GET_LOCK('Test', 1)

but the following SQL code does not:

SELECT GET_LOCK ('Test', 1)

And that is a bug.

It also means that contrived code like

SELECT `GET_LOCK(` FROM Some_Table

will disable multiplexing.

renecannao commented 1 month ago

Indeed, that is a bug, and apparently easy to fix too: just remove the parenthesis.

SELECT GET_LOCK( FROM Some_Table

I hope you don't have a column with that name...

Are there applications still using GET_LOCK() ?