Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot suppress SET character_set_client=utf8? #3736

Open
jploski opened this issue Dec 26, 2021 · 2 comments
Open

Cannot suppress SET character_set_client=utf8? #3736

jploski opened this issue Dec 26, 2021 · 2 comments

Comments

@jploski
Copy link

jploski commented Dec 26, 2021

I'm trying to use query rewrite rules to get rid of "SET character_set_client=utf8" that is being sent to my (Clickhouse-using-MySQL-protocol) backend by the MySQL Workbench client (which makes any connection attempt fail). Using ProxySQL version 2.2.0-72-ge14accd, codename Truls.

I added this rule in an attempt to neutralize all SET statatements:

INSERT INTO mysql_query_rules (active, match_pattern, replace_pattern) VALUES (1,"^SET .*$", "select * from system.parts where 1=0");
LOAD MYSQL QUERY RULES TO RUNTIME;

If I use the mysql CLI client, I can see in stats.stats_mysql_query_rules that the rule works when I execute the statement "SET character_set_client=utf8" directly through it. But when I try connecting through the MySQL Workbench, the rule does not fire, rather, the statement is passed through to the backend Clickhouse, where I of course get the error:

executeQuery: Code: 62. DB::Exception: Syntax error: failed at position 26 ('utf8'): utf8. Expected one of: TRUE, FALSE, literal, NULL, number, Bool, true, false, string literal. (SYNTAX_ERROR) (version 21.12.2.17 (official build)) (from 127.0.0.1:41456) (in query: SET character_set_client=utf8)...

(The reason why I'm not using the Clickhouse module of ProxySQL is that it reliably crashes ProxySQL - but that's another story.)

@jploski
Copy link
Author

jploski commented Dec 26, 2021

Note, there is also an open issue in Clickhouse regarding all the incompatibilities that bother MySQL clients: ClickHouse/ClickHouse#9336

@jploski
Copy link
Author

jploski commented Dec 26, 2021

FWIW, I got it to connect by recompiling ProxySQL with the following patch (which is obviously not a good idea to include in any official code base, just a proof-of-concept)

https://gist.github.com/jploski/0ce2a9b797f0055085827e687f28f3e8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant