dolthub / dolt

Dolt – Git for Data
Apache License 2.0
17.58k stars 498 forks source link

CREATE USER allows username over 32 chars, then SELECT throws error #8120

Closed christopherreay closed 1 month ago

christopherreay commented 1 month ago

Hi first issue, thanks for the great product.

so here is reproducible in dolt sql:

create user "abcdefghijklmnopqrstuvwxyz0123456789"@'localhost' identified by 'abc123';
Query OK, 0 rows affected (0.02 sec)
select User from mysql.user ;
string 'abcdefghijklmnopqrstuvwxyz0123456789' is too large for column 'char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin'

the actual user works perfectly well in terms of connecting/authenticating and running queries. Personally I would prefer to be able to have usernames longer than 32 chars, but either way is fine.

fulghum commented 1 month ago

Hi @christopherreay, thanks for reporting this issue and providing the repro script. 🙏

Since MySQL limits usernames to 32 characters, we'll go ahead and get this patched up so that Dolt also validates the user name length on the call to CREATE USER. We're generally open to extending MySQL and having larger limits if customers do need them, so let us know if this limit does cause a problem, otherwise we'll get Dolt patched up to match MySQL's behavior here.

fulghum commented 1 month ago

I've got this one queued up for the next release. I'm going to release it as a minor version bump, just in case anyone is relying on the old (unvalidated) behavior. We're waiting for one more change to land tomorrow, but if you need this out sooner than that, we're happy to run a separate release for you.

fulghum commented 1 month ago

This fix has been released in Dolt version 1.42.0

Thanks for taking the time to report the issue so we could fix it. 🙏 Let us know if there's anything else we can do to help you build with Dolt!