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

Tables with hyphen character cause mysql client to drop connection #4245

Closed
druvv opened this issue Jul 18, 2022 · 3 comments
Closed

Tables with hyphen character cause mysql client to drop connection #4245

druvv opened this issue Jul 18, 2022 · 3 comments
Labels
bug Something isn't working sql server Issues related to the built in SQL server

Comments

@druvv
Copy link
Contributor

druvv commented Jul 18, 2022

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 {}
@druvv druvv added bug Something isn't working sql server Issues related to the built in SQL server labels Jul 18, 2022
@druvv
Copy link
Contributor Author

druvv commented Jul 18, 2022

The workaround is to supply the -A flag when using mysql to connect to a GMS backed server like Dolt.

@VinaiRachakonda
Copy link
Contributor

I think you should move this entire issue to Dolt. The repro is not specific to GMS.

@timsehn timsehn transferred this issue from dolthub/go-mysql-server Aug 31, 2022
@zachmu
Copy link
Member

zachmu commented Feb 11, 2023

This was fixed last week.

@zachmu zachmu closed this as completed Feb 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sql server Issues related to the built in SQL server
Projects
None yet
Development

No branches or pull requests

3 participants