go-mysql-server
go-mysql-server copied to clipboard
Tables with hyphen character cause mysql client to drop connection
The mysql client likes to read table names and column names on startup to enable autocompletion:
> mysql -h"some_url"
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
If one of the tables it reads contains a hyphen, for example test-table
then the following query fails to be parsed.
SELECT * from test-table LIMIT 0;
This causes the mysql client to think the connection was dropped.
Repro:
> dolt sql -q 'CREATE table `test-table` (pk int PRIMARY KEY);'
> dolt commit -am "add test table"
> dolt sql-server
# separately
> mysql -h"127.0.0.1" -u"root"
mysql> use test;
mysql> SELECT * from dolt_branches;
ERROR 2008 (HY000): MySQL client ran out of memory
No connection. Trying to reconnect...
Connection id: 5
Current database: old_format
ERROR 2008 (HY000): MySQL client ran out of memory
No connection. Trying to reconnect...
Connection id: 6
Current database: old_format
ERROR 2008 (HY000): MySQL client ran out of memory
mysql>
dolt sql-server
logs:
2022-07-18T15:10:47-07:00 WARN [conn 6] error running query {connectTime=2022-07-18T15:10:47-07:00, connectionDb=old_format, error=syntax error at position 20 near 'test', query=SELECT * FROM test-table LIMIT 0;}
2022-07-18T15:10:47-07:00 INFO [conn 6] ConnectionClosed {}