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

Can't create database with navicat: Dolt does not accept single quotes on charset identifier #4977

Closed
Jinsns opened this issue Dec 13, 2022 · 5 comments · Fixed by dolthub/vitess#208
Labels
bug Something isn't working integrations Issues with tools connecting to/querying Dolt

Comments

@Jinsns
Copy link

Jinsns commented Dec 13, 2022

image

I'm using navicat premium 15. When I try to create a new database or import data from a csv to create a new table, error happens.
I guess there are some problems with the quotation mark in the sql corresponding to the operation of navicat. If I copy that sql to cli, same error will happen, while ok without the quotation mark.
image

@timsehn timsehn added bug Something isn't working integrations Issues with tools connecting to/querying Dolt labels Dec 13, 2022
@timsehn
Copy link
Contributor

timsehn commented Dec 13, 2022

So, these queries work on the tip of main outside of navicat:

$ dolt sql-client
--user or -u argument is required
$ dolt sql-client -u root
# Welcome to the Dolt MySQL client.
# Statements must be terminated with ';'.
# "exit" or "quit" (or Ctrl-D) to exit.
mysql> create database `foo`
    -> ;
mysql> create database `bar` character set `utf8mb4`;
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| bar                |
| foo                |
| information_schema |
| mysql              |
+--------------------+
4 rows in set (0.00 sec)

mysql>

I think we just added support for collations on databases on Nov 1.

#4629

Are you using the latest Dolt version?

@fulghum
Copy link
Contributor

fulghum commented Dec 13, 2022

It looks like this has to do with the quoting for 'utf8mb4'. Dolt will execute that query when the character set is in backticks, but returns a syntax error when it's in single quotes. MySQL will happily accept it either way.

mysql> create database `bar2` character set 'utf8mb4';
Query OK, 1 row affected (0.01 sec)

We should update our parser to allow charsets to be specified in single quotes and double quotes, in addition to the existing support for backtick/identifier quotes.

@timsehn
Copy link
Contributor

timsehn commented Dec 13, 2022

Good catch. I totally missed the regular ticks on the charset.

@timsehn timsehn changed the title Can't create database with navicat Can't create database with navicat: Dolt does not accept single quotes on charset identifier Dec 13, 2022
fulghum added a commit to dolthub/vitess that referenced this issue Dec 13, 2022
@fulghum
Copy link
Contributor

fulghum commented Dec 13, 2022

Thanks for reporting this! I've made a quick change to our sql parser to allow charsets and collation names to be in single quotes or double quotes when used in create database or alter database statements. I took a quick look at other places charsets/collation names are used (e.g. create table options) and it looks like single/double quotes are already supported there.

We'll get this merged in today and out in the next release of Dolt, likely today or tomorrow. Using backtick quotes is a good workaround for this until the fix is released.

@fulghum
Copy link
Contributor

fulghum commented Dec 14, 2022

Hey @Jinsns – just wanted to let you know that this fix was just released in Dolt 0.51.13

Thanks again for taking the time to report this so we could fix it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working integrations Issues with tools connecting to/querying Dolt
Projects
None yet
3 participants