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
Enhanced MySQL compatibility #9336
Comments
@meob , yes please add all incompatible commands that you have found so far. It will help a lot with implementation and testing. One more requirement: compatibility mode should also support double quotes for strings, as MySQL does. |
This one is very questionable, as MySQL behavior in that part is not standard and adjustable: |
Yes, it is not standard, but it is default MySQL behaviour. If we want compatibility mode it makes sense to be compatible with defaults. |
I collected the SQL statements used by some tipical MySQL tools. phpMyAdmin 3.5.5 (Legacy) phpMyAdmin 5.0.1 (Latest version) DBeaver 6.3.5 (Latest version) |
…-java setup for MySQL Handler ClickHouse#9336 mysql-connector setup query: /* mysql-connector-java-5.1.38 ( Revision: ${revinfo.commit} ) */SELECT @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_connection, @@character_set_results AS character_set_results, @@character_set_server AS character_set_server, @@init_connect AS init_connect, @@interactive_timeout AS interactive_timeout... ClickHouse side Error: {} <Error> executeQuery: Code: 62, e.displayText() = DB::Exception: Syntax error: failed at position 74: @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_conn. Expected one of: CAST, NULL... Client side Exception: java.sql.SQLException: Syntax error: failed at position 74: @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_conn. Expected one of: CAST...
Comments: mysql-connector-java-5.1.34: |
* Skip the `/* comments */ SELECT @@variables ...` from mysql-connector-java setup for MySQL Handler #9336 mysql-connector setup query: /* mysql-connector-java-5.1.38 ( Revision: ${revinfo.commit} ) */SELECT @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_connection, @@character_set_results AS character_set_results, @@character_set_server AS character_set_server, @@init_connect AS init_connect, @@interactive_timeout AS interactive_timeout... ClickHouse side Error: {} <Error> executeQuery: Code: 62, e.displayText() = DB::Exception: Syntax error: failed at position 74: @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_conn. Expected one of: CAST, NULL... Client side Exception: java.sql.SQLException: Syntax error: failed at position 74: @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_conn. Expected one of: CAST... * add repalce 'SHOW VARIABLES' for mysql-connector-java-5.1.34 #9336 * Add java client(JDBC) integration test to test_mysql_protocol * shift out java tests from dbms * Update MySQLHandler.cpp * Update MySQLHandler.cpp * test_mysql_protocol: add Test.java exit code 1 when expection Co-authored-by: alexey-milovidov <milovidov@yandex-team.ru>
Comments: There are already 3 patches in place to address this compatibility issue: They addressed the SET commands:
These SET commands will return OK to the client/driver-side. SELECT commands:
These SELECT commands will return max_allowed_packet by default. |
:) |
Comments: workbench 8.0:
|
Comments: |
Comments: |
Comments: |
I have the same problem for Code: 62, e.displayText() = DB::Exception: Syntax error: failed at position 5 ('@@'): @@wait_timeout = 2147483. Expected one of: ROLE, identifier, ROLE DEFAULT, DEFAULT ROLE (version 20.7.2.30 (official build)) Is there any news about this? |
Not support |
Comments: |
Most prefab queries use just UNION. MySQL assumes DISTINCT by default. CK fails. Wouldn't be nice to have a setting to establish default behaviour of UNION to UNION ALL (and set it by default on mysql sessions)? |
.NET driver needs TIMEDIFF function: |
While trying to connect to Clickhouse using MySQL Workbench I ran into those: show character set where charset = .* I was able to rewrite all of them using ProxySQL's mysql_query_rules. But there is one which I cannot work around because it seems to be exempt from rewriting (sysown/proxysql#3736): SET character_set_client=utf8; Edit: I managed to work around it by hacking ProxySQL. |
Any progress on this issue? It would really be lovely to have MySQL tooling working (workbench, PHPMyAdmin) |
@jbenguira Hi! There is no progress on this issue. |
We hit a similar issue with PowerBI - it tries to run this query:
When it first opens the connection, which results in clickhouse throwing:
|
@devicenull the query works:
|
I agree, it works via clickhouse-client, but doesn't appear to work via the mysql port. Either way, we've moved to OBDC access for PowerBI, which is working fine. |
Does jdbc's allowMultiQueries = true require support? |
Basically `DATABASE()` and `SCHEMA()` are aliases in MySQL. This helps with allowing MySQL Shell to get one step closer to a functioning connection. To see what MySQL Shell does: ``` mysqlsh --verbose=4 --log-sql=unfiltered mysql://default@127.0.0.1:9004 ``` This might also bring other tools a step closer to working with the MySQL compatibility of ClickHouse. Ref: ClickHouse#9336 Signed-off-by: Daniël van Eeden <git@myname.nl>
Use case
The basic idea is to increase the MySQL compatibility with wire protocol in order to have tools like phpMyAdmin, DBeaver, ... working easily on ClickHouse (reading data)
Describe the solution you'd like
ClickHouse MySQL wire protocol works fine with application (eg. PHP, Perl, ...) but has problems with MySQL tools since they use "custom" SQL commands that MySQL understand while ClickHouse gives problems.
We propose to add a flag that enhance MySQL compatibility.
The solution requires two approach:
There are commands like "SET NAMES utf8", "SET autocommit=1", ... that have no meaning
and can simply do nothing in CH but reply OK if the flag is active
This can be easly created in ClickHouse using VIEWs from SYSTEM
The goal is to reach a "read only" compatibility with MySQL.
Creating CH data structures or traslating DML language requires much more work
and is not needed.
Describe alternatives you've considered
I used a simple self-made proxy to skip MySQL custom command... and it works!
Additional context
This compatibility could enable CH+wire protocol to be used as a MySQL DB with Linked Server in SQLServer, FDW in PostgreSQL, Oracle gateway, ...
I can provide the list of commands, variables, data dictionary views I have found till now...
The text was updated successfully, but these errors were encountered: